how to get rid of the input beginning white spaces
Can anyone show me a quick way of getting rid of white spaces in c
for instance, user input <space> <tab> <space> hello and I use read () to get the entire line and store it in an array called buf[ ] so my buff is stored wit useless white spaces, if I do a strlen(buf), it will return 3 how can I write a function that gets rid of all the while spaces and my buff just stores hello? |
Code:
char *p = buf; |
thanks man, you've been my life saver, one quick question
*p++ = 0 that means, set *p to point to 0 and then increase pointer to the next item, right? |
*p++ = 0
means to change the value that p points to to 0 and then point to the next item. |
All times are GMT -5. The time now is 07:21 AM. |