• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
FAQ: Portable printf spec for Pascal strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: Preferences File & storing in .app
  • Next by Date: Re: Preferences File & storing in .app
  • Previous by thread: Re: Preferences File & storing in .app
  • Next by thread: Build Style specific files
  • Index(es):
    • Date
    • Thread