Error de error en la lectura de un archivo con fgets
//declare double pointer so that create array can "return" an array
int **aryReturn;
int size;
char trashdata[100];
//open file
FILE *inFilePtr = fopen(*(argv + 1), "r" );
if (inFilePtr != NULL)
printf(" the value of argv 1 is %s \n", argv[1]);
while (fgets(trashdata, sizeof(int) * 10, inFilePtr) != NULL){
fgets(trashdata, 10, inFilePtr);
size++;
}
¿Alguien puede decirme por qué mi condición de bucle no funciona? Me sale un fallo de seg que dice fp (0x0) en fgets. Yo he tratado
while (!feof(inFilePtr))
Y básicamente recibo el mismo error, pero dice que el problema es feof.
Mi archivo parece abrirse correctamente porque la instrucción if se imprime ... y argv tiene el nombre de archivo esperado