[chbot] C prinf() %s

Mark Atherton markaren1 at xtra.co.nz
Tue Nov 22 03:10:21 GMT 2011


Or.. copy the array to a temp array, then scan the temp array and 
overwrite the \n with \0 ?

At 04:03 p.m. 22/11/2011, hamster wrote:
>You could try something like
>printf("%*.*s",strlen(str)-1,strlen(str)-1,str) to limit your output.
>
>Or you could  fwrite(str,strlen(str)-1,1,stdout) to write all but the last
>byte.
>
>On Tue, 22 Nov 2011 15:19:39 +1300, jimmy allen <jimmy1248 at gmail.com>
>wrote:
> > Hello All
> >
> > So here is a problem, I have a char array that is '\n' terminated.
> > Using the printf family I want to print the array.The catch is I do
> > not want the '\n' to be printed.
> > Apparently there is a flag for the the %s formatter that will print a
> > char array with out the '\n'.
> >
> > I have tried to find it on the net but haven't got far.
> >
> > Any help would be great.
> >
> > Cheers
> >
> > Jimmy
> >
> > _______________________________________________
> > Chchrobotics mailing list Chchrobotics at lists.linuxnut.co.nz
> > http://lists.ourshack.com/mailman/listinfo/chchrobotics
> > Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> > Web site: http://kiwibots.org
> > Meetings 3rd Monday each month at Tait Radio Communications, 175
>Roydvale
> > Ave, 6.30pm
> >
> > When replying, please edit your Subject line to reflect new content.
>
>_______________________________________________
>Chchrobotics mailing list Chchrobotics at lists.linuxnut.co.nz
>http://lists.ourshack.com/mailman/listinfo/chchrobotics
>Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
>Web site: http://kiwibots.org
>Meetings 3rd Monday each month at Tait Radio Communications, 175 
>Roydvale Ave, 6.30pm
>
>When replying, please edit your Subject line to reflect new content.




More information about the Chchrobotics mailing list