0
FILING CABINET
The first line is the header I want to disregard. So that the counter "num" does not start counting from the HEADER
Company About Funcao Name
Empresaa Bedecs Anna Proprietario
Empresab Gratacos Antonio Proprietario
Empresac Axen Thomas Shopping
Empresad Lee Christina Manager
Empresae Odonnell Martin Proprietario
Empresaf Prezolaeta Francisco Manager
Empresag Xie Ming-Yang Proprietary
Empresah Andersen Elizabeth Representative
Empresai Mortensen Sven Shopping
Empresaj Wacker Roland Shopping
Empresak Krschne Peter Manager
Empresal Edwards John Manager
Empresam Ludick Andre Representative
Empresan Grilo Carlos Representative
Empresao Kupkova Helena Manager
Empresap Goldschmidt Daniel Representative
Empresaq Bagel Jean Proprietario
Loan Autier Catherine Representative
Eggerer Alexander Accounting companies
Empresat Li George Manager
Empresau Tham Bernard Manager
Empresav Ramos Luciana Assistant
Empresaw Entin Michael Manager
Empresax Hasselberg Jonas Proprietario
Empresay Rodman John Manager
Empresaz Liu Run Assistant
Empresaaa Toh Karen Manager
Empresabb Raghav Amritansh Manager
Empresacc Lee Soo Manager
SOURCE CODE BELOW
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <unistd.h>
main(){
FILE * input_text, *output_text;
char line[1024];
char * last;
int num = 0;
setlocale(LC_CTYPE,"");
if((input_text = fopen("entrada03.txt","r")) == NULL)
printf("\n[ERRO]Travou o Nintendo!\n");
else
printf("\n[SUCESSO]Sucesso ao abrir o arquivo!\n\n");
printf("\n\nImprimindo a saida\n\n");
sleep(2);
output_text = fopen("saida02.txt","w");
while(!feof(input_text)){
fgets(line, 1024, input_text);
last = strtok(line, "\n"); //"last" recebe variável "line" até o delimitador "\n"
while(last != NULL){ //Se last não for "NULL" executa essa
printf("%d: %s\n",num, last);
last = strtok(NULL, "\n"); //Se last for "NULL" até o delimitador "\n"
fprintf(output_text,"%d: %s\n", num, line);
}
num++;
}
fclose(input_text);
fclose(output_text);
printf("\n");
system("pause");
}
good ok, that was it right there. Thank you, a simple detail changes everything.
– fvsgamers
Great that it served. Hugs!
– Rafael Megda