TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Gary Chambers
from: Bill Parker
date: 1994-12-25 20:45:36
subject: sprintf`ing /0`s

BP> If you need to dynamically build the string then you could 
BP> use sprintf with a format of...
BP> 
BP> "APPNAME\0%s\0%s\0%s\0\0"

 NF> Won't sprintf get stuck with the first \0 and think it's the string
 NF> termination?

Yup. I've even been through that mistake before but the experience wasn't
enough to make it stick in my memory.

 NF> Perhaps it should be better sprintf( buffer, "APPNAME%c%s%c%s..
 NF> ...%c%c", '\0', FirstParam, '\0', SecondParam, '\0',
 NF> ....., '\0', '\0' );

Yup. Sorry about the bum info, Gary...Nelson's got it straight.

Bill

--- Maximus/2 2.01wb
* Origin: Blue Bird Of Prey * Vergennes, VT * (802) 877-6912 (1:325/207)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1
@PATH: 325/207 118 320/209 142/1 3615/50 229/2 12/2442 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.