when I try to use those functions it sends this error:
main.cpp: In function ‘int main()’:
main.cpp:11:17: error: conversion from ‘int’ to non-scalar type ‘fpos_t {aka _G_fpos_t}’ requested
main.cpp:18:20: error: cannot convert ‘fpos_t {aka _G_fpos_t}’ to ‘FILE* {aka _IO_FILE*}’ for argument ‘1’ to ‘int fgetpos(FILE*, fpos_t*)’
The code is:
#include<stdio.h>
struct registro{
char nombre[5];
};
int main()
{
FILE *fp;
registro datos[5];
fpos_t posicion=5;
fp = fopen("nombres.txt","w"); //CREA UN ARCHIVO DE TEXTO
printf("ingrese nombre: ");
gets(datos[1].nombre);
fgetpos(posicion,fp);
fwrite(&datos[1],5,1,fp); //ESCRIBE EL VALOR DE DATOS EN FP, CON UN TAMAÑO DE 5
fflush(stdin);
fclose(fp);
}
If you see any error please help.