C strip whitespaceUploader: Kolton 23 days ago Subscribe 3029
Sorry, the first answer isn't good at all unless you don't care about memory leaks. To handle a larger selection of whitespace the following functions meet the task. It has too much noise around the useful information. Have a doubtwrite here. It is common then to have many trailing spaces in such variables. Before commenting you must escape your source code before commenting. What is done with the argument is this: I needed to tokenize a larger string, and then take the substring s and find the last one - so I could remove a newline from fgets call, and also remove the whitespace from the front of that token -- so I could easily compare it with a static string. Compiled with 'cc trim.