Hi everyone! I hope that u will be able to help me with this small problem.
I got this program that reads characters from a txt file and stores them in a array.
I then want to display the characters but when i do it comes up as squares and funny looking symbols? Why is this, what is wrong with my code?
Your help is greatly appreciated
Many thanks in advance
#include <iostream.h>
#include <fstream.h>
int main()
{
char Name[3][15];
fstream f("a:Names1.dat", ios::in);
if (!f)
cout << "Error opening file";
else {
for (int a = 0; a < 3; a++) {
for (int b = 0; b < 15; b++) {
f >> Name[a][b];
}
cout << endl;
}
}
f.close();
for (int c = 0; c < 15; c++) {
for (int d = 0; d < 15; d++) {
cout << Name[c][d];
}
cout << endl;
}
}