From: Nandar <Nandar@xxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Message-ID: <000a01c5708d$7840a7d0$0d01a8c0@edp10>
Date: Tue, 14 Jun 2005 10:01:59 +0700
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0007_01C570C8.1A876C60"
Subject: Com 1
Hi,.
any one to know, how to send ascci file to com1 port from php ??
thx,
nandar
$ascii_file_data='This is my test data';
// Your temp directory : Acquire filename handle
$tmpdir="C:\temp\";
$filename=tempnam($tmpdir,"file_prefix_");
// Write data to file
$fp=fopen($filename);
fwrite($fp, $ascii_file_data);
fclose($fp);
// Send file contents to COM1
$command="type ".$filename." > com1";
exec($command, $result);
// Remove temp file
fclose($filename);
unlink($filename);
See also "Output redirection in DOS" :
http://zone.ni.com/devzone/conceptd.nsf/webmain/822FA8FC01C3C0C086256A7100546D8E
Cheers - Neil
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php