From: Nandar <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Message-ID: <[EMAIL PROTECTED]>
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

Reply via email to