Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*James Maeding
Message 1 of 7 (322 Views)

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

322 Views, 6 Replies
07-26-2005 04:25 PM
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
*Doug Broad
Message 2 of 7 (322 Views)

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

07-26-2005 05:06 PM in reply to: *James Maeding
(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
Distinguished Contributor
EC-CAD
Posts: 5,929
Registered: ‎12-12-2003
Message 3 of 7 (322 Views)

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

07-26-2005 05:16 PM in reply to: *James Maeding
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
*Tony Tanzillo
Message 4 of 7 (322 Views)

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

07-27-2005 04:13 AM in reply to: *James Maeding
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
*James Maeding
Message 5 of 7 (322 Views)

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

07-27-2005 10:07 AM in reply to: *James Maeding
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
*James Maeding
Message 6 of 7 (322 Views)

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

07-27-2005 10:11 AM in reply to: *James Maeding
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
*Owen Wengerd
Message 7 of 7 (322 Views)

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

07-27-2005 02:28 PM in reply to: *James Maeding
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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.