I've been trying to write some text in a file then store this text in a char array, but it keeps ignoring spaces. this is the code I've been trying. thanks!
ofstream ofile;
ofile.open("file.txt");
int i,item;
char array[100];
ofile << "Amna Alhadi Alnajjar" << endl;
ofile.close();
ifstream ifile;
ifile.open("file.txt");
i=0;
while(!ifile.eof())
{
ifile >> array[i];
i++;
}
ifile.close();
i=0;
while(array[i]!='\0')
{
cout<< array[i];
i++;
}