On Oct 17, 1:37 pm, "Bint" <b...@csgs.com> wrote:
> Hi,
>
> I have a giant string buffer, and I want to print out small chunks of it at
> a time. How do I print out, say 20 characters of a string?
>
> Is it like this?
>
> printf("%20s",mystring);
>
> I can change the start point of the string, I just don't know how to tell it
> to only print out X number of characters from it.
> Thanks
> B
Bint,
Another more flexible method would be to snprintf() your larger string
into a temporary string buffer and then output the temporary buffer
using a standard unformatted printf(). This will allow you to
dynamically change the size of your output string by supplying a
variable length for your temporary string buffer in the snprintf()
routine (which cannot be accomplished using the "%.20s" method
described by Richard.
Keith
http://www.doubleblackdesign.com