Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add a null character (ascii 0) to a string..

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
1184 Views, 6 Replies

How to add a null character (ascii 0) to a string..

I am making a png file from some data downloaded.
I have to throw in null characters here and there and do not know how to write a null character to a file.
The null character is the ASCII character 0.
any ideas?
thx
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

(chr 0) ?


"James Maeding" wrote in message news:4911840@discussion.autodesk.com...
I am making a png file from some data downloaded.
I have to throw in null characters here and there and do not know how to write a null character to a file.
The null character is the ASCII character 0.
any ideas?
thx
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Message 3 of 7
EC-CAD
in reply to: Anonymous

Let's say you have a symbol A, with value of "ABC".
To 'add' a Character 0..do
(setq A (strcat A (chr 0))); add null to end

Bob
Message 4 of 7
Anonymous
in reply to: Anonymous

You can't make a PNG file in LISP. LISP cannot
write or read binary files.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"James Maeding" wrote in message news:4911840@discussion.autodesk.com...
I am making a png file from some data downloaded.
I have to throw in null characters here and there and do not know how to write a null character to a file.
The null character is the ASCII character 0.
any ideas?
thx
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Message 5 of 7
Anonymous
in reply to: Anonymous

what about (write-char 256 fn)?
It worked for us...

Tony Tanzillo
|>You can't make a PNG file in LISP. LISP cannot
|>write or read binary files.

James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Message 6 of 7
Anonymous
in reply to: Anonymous

if you add 256 to the ascii value, things take care of themselves, odd but true.
so the null char is actually (char 256)
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Message 7 of 7
Anonymous
in reply to: Anonymous

James:

> if you add 256 to the ascii value, things take care of themselves...

What happens when you try to write a 10, 13, or 26 using that approach?
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost