Pagini recente » Cod sursa (job #2768440) | Cod sursa (job #2590257) | Cod sursa (job #300992) | Cod sursa (job #586954) | Cod sursa (job #1349671)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main(void){
freopen("convertor.in", "r", stdin);
int cap = 1024;
int cont = 0;
char *text = (char*)malloc(cap * sizeof(char));
char buffer[1024];
while(gets(buffer)){
cont = cont + strlen(buffer) + 1;
if(cont >= cap){
cap = cap * 2;
text = (char*)realloc(text, cap * sizeof(char));
}
strcat(text, buffer);
}
char *token;
token = strtok(text, "}");
while(token != NULL){
printf("%s\n", token);
token = strtok(0, "}");
}
// printf("%s", text);
return 0;
}