Think about it this way:
 
There is only one value of zero. Representing it as hex does not change the value. When the zero is stringified, it is converted to ASCII 30. To get a specific ASCII character, use chr(). So what you want is the ASCII NUL which is chr(0).
 
- Mark.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Warner, William A
Sent: Friday, September 23, 2005 8:38 AM
To: Perl-Win32-Users@listserv.ActiveState.com
Subject: Writing Control Codes to a file?

When I write to a file, most everything goes in as 30 or greater. For instance, this code:

 

binmode OUT_FILE;

           syswrite OUT_FILE, 0x0;

 

Puts a 30 in the DOS debug screen’s left pane and puts a 0 in the DOS debug’s right screen.

 

I understand that an ascii zero is represented by a hex 30, but I expected that outputting a hex value of 0 would give me a hex value into the file, but instead it gives an ascii 0 value in the file.

 

I can put one value of less than 30 in the file. I can put a space in the file which is hex 20 with this code:

 

binmode OUT_FILE;

           syswrite OUT_FILE, “ “;

 

since a space is represented by hex 20. How do I put the other 29 values below 30 into a file?

 

Thanks!

 

Bill Warner


******************************* The information contained in this message may be privileged and/or confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. Note that any views or opinions presented in this message are solely those of the author and do not necessarily represent those of Ameren. All emails are subject to monitoring and archival. Finally, the recipient should check this message and any attachments for the presence of viruses. Ameren accepts no liability for any damage caused by any virus transmitted by this email. If you have received this in error, please notify the sender immediately by replying to the message and deleting the material from any computer. Ameren Corporation *******************************
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to