hello, I want to read lines into an array (I will later work with the array of pointer , so that is why I use it)
well this is my code that doesn't work correctly, does anybody now why?
I created a simple txt document for this which has only a few lines
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
char*retazce[50];
FILE*pFile;
int line=0;
pFile = fopen ("text.txt" , "r");
if (pFile == NULL) perror ("Error opening file");
else {
for (int i=0; i<50; i++) {
while(fgets(retazce[i], 100, pFile)!=NULL) {
fgets(retazce[i], 100, pFile);
line++;}}
}
for (int i=0; i<50;i++)
cout<< retazce[i] <<"toto bol retazec" << endl;
cout<<"pocet riadkov "<< line<<endl;
cin.ignore();
cin.ignore();
return 0;}