1
I am trying to open and read a C file and then print the result but when printing it does not come out complete in case it has a 32 x 32 text image.
Besides I would also like to know how I will read a variable file equal to it (for example I was thinking of storing the data in a vector and then scan with fgets).
void abriArquivo(){
char Linha[1024];
char *result;
FILE *file;
file = fopen("GIMP.pgm","rt");
if(file == NULL){
printf("Problemas na abertura do arquivo \n");
}
int i = 1;
while(!feof(file)){
result = fgets(Linha,1024,file);
if(result)
printf("Linha %d : %s "Linha);
i++
}
fclose(file)
}
int main(int argc, char **argv){
int contParam;
char arquivo[100] = "";
for(contParam = 0; contParam < argc; contParam++){
if(!strcmp(argv[contParam],"-r")){
//abrirArquivo();
contParam += 1;
}
else if(!strcmp(argv[contParam],"-arquivo")){
abrirArquivo();
contParam += 1;
}
/* else if(!strcmp(argv[contParam],"-d")){
strncpy(,argv[contParam + 1],20);
*/ contParam += 1;
}
}
}
Good afternoon get changing the value from 1024 to 100, thanks, but this printf(Arq) can not implement
– Luiz Fernando Rosa