FAQ: Portable printf spec for Pascal strings
FAQ: Portable printf spec for Pascal strings
- Subject: FAQ: Portable printf spec for Pascal strings
- From: Chris Espinosa <email@hidden>
- Date: Mon, 3 May 2004 10:38:15 -0700
After some review I found that the portable way of printing Pascal
strings I posted last week has a small bug: it overruns the string if
the character at pstr[pstr0]+1] is not null. This is due to different
behavior in printf between field width specifications and precision
specifications.
For the record, the portable way to printf Pascal strings in Mac OS X
(because it doesn't support the MSL extension %#s) is
printf("%.*s", pstr[0], &pstr[1])
Chris
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.