Last active
October 20, 2016 14:11
-
-
Save BillMoriarty/da872ecb09ddfa17fee659ea758ce9a7 to your computer and use it in GitHub Desktop.
function that we wrote in class last week to remove the trailing new line character from the filename(which is found by isspace)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Hi all - I am currently a student. The code below was developed during student projects. It may not be the most efficient or robust. | |
Use it if it's helpful for you. | |
-Bill Moriarty | |
*/ | |
/* written by J. Fiore for 2107 class* / | |
/* | |
For the "C" locale, white-space characters are any of: | |
' ' (0x20) space (SPC) | |
'\t' (0x09) horizontal tab (TAB) | |
'\n' (0x0a) newline (LF) | |
'\v' (0x0b) vertical tab (VT) | |
'\f' (0x0c) feed (FF) | |
'\r' (0x0d) carriage return (CR) | |
http://www.cplusplus.com/reference/cctype/isspace/ | |
*/ | |
void remove_trailing_space(char s[]) { | |
int len=strlen(s); | |
int i; | |
i=len-1; | |
while (i>=0 && isspace(s[i])) { | |
s[i]='\0'; | |
i--; | |
} | |
} /* end void remove_trailing_space(char s[]) */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment