Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX_LENGTH 1000
- int get_line(char line[]);
- int
- main()
- {
- char line[MAX_LENGTH];
- int line_length;
- int tab_length;
- tab_length = 4;
- while ((line_length = get_line(line)) > 0)
- {
- /* output hier */
- }
- return 0;
- }
- int
- get_line(char line[])
- {
- int i;
- char c;
- for (i = 0; i < MAX_LENGTH - 1 &&
- (c = getchar()) != EOF &&
- c != '\n'; i++)
- {
- line[i] = c;
- }
- if (c == '\n')
- {
- line[i] = c;
- i++;
- }
- line[i] = '\0';
- return i;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement