Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define EOL '\n'
- #define TAB '\t'
- #define SPACE ' '
- #define TABSTOP 4
- int main() {
- int n = 0;
- while(1) {
- int c = getchar();
- if(c == EOF) {
- break;
- }
- if(c == EOL) {
- putchar(c);
- n = 0;
- continue;
- }
- if(c == TAB) {
- while(n < TABSTOP) {
- putchar(SPACE);
- n++;
- }
- if(n >= TABSTOP) {
- n = 0;
- }
- continue;
- }
- putchar(c);
- n++;
- if(n >= TABSTOP) {
- n = 0;
- }
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement