Zexanima

Untitled

Jan 6th, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. /*
  2. This program is used to remove white space from input
  3.     - Delete trailing blanks/tabs
  4.     - Delete blank lines
  5. */
  6. #include <stdio.h>
  7.  
  8. #define MAX_OUTPUT 500
  9.  
  10. /*
  11. Checks to see if a character is considered whitespace.
  12. */
  13. int isWhitespace(char c)
  14. {
  15.     (c == '\n' || c == ' ' || c == '\t') ? 1 : 0;
  16. }
  17.  
  18. /*
  19. Removes trailing white spaces from character string.
  20. */
  21. void removeWhiteSpace(char s[], int len)
  22. {
  23.     for(int i = len; i >= 0; i--)
  24.     {
  25.         // Dont know what I'm going to do here...
  26.     }
  27. }
  28.  
  29. /*
  30. Reads input to s.
  31. */
  32. int readInput(char s[])
  33. {
  34.     char c, lastChar;
  35.     int count;
  36.     count = 0;
  37.     while((c = getchar()) != EOF && count < MAX_OUTPUT)
  38.     {
  39.         s[count] = c;
  40.         count++;
  41.     }
  42.     return count;
  43. }
  44.  
  45. int main()
  46. {
  47.     char output[MAX_OUTPUT];
  48.     int outputLength;
  49.     outputLength = readInput(output);
  50.     removeWhiteSpace(output);
  51.     printf("\n[*] Your input modded:\n %s\n", output);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment