Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This program is used to remove white space from input
- - Delete trailing blanks/tabs
- - Delete blank lines
- */
- #include <stdio.h>
- #define MAX_OUTPUT 500
- /*
- Checks to see if a character is considered whitespace.
- */
- int isWhitespace(char c)
- {
- (c == '\n' || c == ' ' || c == '\t') ? 1 : 0;
- }
- /*
- Removes trailing white spaces from character string.
- */
- void removeWhiteSpace(char s[], int len)
- {
- for(int i = len; i >= 0; i--)
- {
- // Dont know what I'm going to do here...
- }
- }
- /*
- Reads input to s.
- */
- int readInput(char s[])
- {
- char c, lastChar;
- int count;
- count = 0;
- while((c = getchar()) != EOF && count < MAX_OUTPUT)
- {
- s[count] = c;
- count++;
- }
- return count;
- }
- int main()
- {
- char output[MAX_OUTPUT];
- int outputLength;
- outputLength = readInput(output);
- removeWhiteSpace(output);
- printf("\n[*] Your input modded:\n %s\n", output);
- }
Advertisement
Add Comment
Please, Sign In to add comment