1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | void remove_space(char *s) { char *start, *end; unsigned int len; while (*s != ' ' && *s != '\t' && *s != '\0') ++s; start = s; while (1) { while (*start != ' ' && *start != '\t' && *start != '\0') ++start; while ((*start == ' ' || *start == '\t') && *start != '\0') ++start; end = start; while (*end != ' ' && *end != '\t' && *end != '\0') ++end; len = end - start; memcpy(s, start, len); s += len; start += len; if (*end == '\0') break; } *s = '\0'; } | cs |
아무리 생각해도 이게 최선인뎅
역슬래시 짤리넹
그냥 두글자만 비교처리하다 파일 끝만나면 끝나는데? 3줄이면 됨
그럼 따로 버퍼 안쓰고 원본 건드려서 하려는데 어케 짬여?