Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. void UNPACK(const char* str, FILE* f) {
  2.     int i = 0;
  3.     while (str[i]) {
  4.         if (str[i] == '(') {
  5.             i++;
  6.             int count = 0;
  7.             while ('0' <= str[i] && str[i] <= '9') {
  8.                 count = count * 10 + str[i] - '0';
  9.                 i++;
  10.             }
  11.  
  12.             i++;
  13.             for (int j = 0; j < count; j++) {
  14.                 fprintf(f, "%c", str[i]);
  15.             }
  16.         }
  17.         else {
  18.             fprintf(f, "%c", str[i]);
  19.             i++;
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement