RE : Subject: Com 1

From: Date: Tue, 14 Jun 2005 13:42:40 +0000
Subject: RE : Subject: Com 1
Groups: php.db 
Request: Send a blank email to php-db+get-39667@lists.php.net to get a copy of this message
From: Nandar <Nandar@batamtex.com> To: php-db@lists.php.net 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

« previous php.db (#39667) next »