so im trying to read a file and get each line of this file and put it in some array, the line i get is of type char and my array is of type string so i dont know if im doing something wrong there, so i try to add that line to my array and when i try to print it shows me this error
cannot pass objects of non-POD type `struct std::string' through `...'; call will abort at runtime
and heres my code
int main(int argc, char *argv[])
{
FILE * file;
char line[1024];
int n = 1024;
string array[1024];
file = fopen("./cursos.txt", "r");
if (file == NULL){
printf("cant open this file\n");
system("pause");
return 0;
}
for(int i =0;i<1024;i++)
{
fgets(line, n, file);
array[i] = line;
}
printf("the string line is %c\n", array[3]);
fclose(file);
system("PAUSE");
return EXIT_SUCCESS;
}
the error is shown in the line where i try to print it
printf("the string line is %c\n", array[3]);
plz heeelp