Rite Online Inc.
Voice: +1 (250) 979-1638
> > Hi,
> > I was windering if there was a way to strip off the invisible null at
> > end of a string.
> > Lets say I have taken a string and split it into individual components.
> > ie: i am canadian
> > var1 = i
> > var2 = am
> > var3 = canadian\0
> > How do I get rid of the \0 at the end of canadian???
> > Any help would be great!
> I don't think you're understanding C strings: ALL strings in C
> are NUL terminated, by definition. In other words,
> var1 = i\0
> var2 = am\0
> var3 = canadian\0
> Rich Teer
> Rite Online Inc.
> Voice: +1 (250) 979-1638
> URL: http://www.rite-online.net
This works for me:
sed -e 's/ *$//'
char *Disclaimer = "My opinions only. Use at your own risk.";
char *Murphy = "NON-RECIPROCAL LAWS OF EXPECTATIONS:"
" Negative expectations yield negative results."
" Positive expectations yield negative results.";