Hi, i have a question about files in c++.
I need to do a program that reads a .txt file and stores it into a bidimentional character array and the show it in screen.
I have this code, but i dont know the conditional for the end of line in c++.
Basically i want to read a whole line and store it and then change the second index of the char matrix and read again, and so on, until the end of the file.
#include <iostream>
#include <fstream>
using namespace std;
int main() {
char menu_art[150][60];
ifstream fe("menu_art.txt");
for(int i=0 ; (menu_art end of line) ; i++)
{
fe.getline(menu_art[],150);
}
for(int i=0 ; i < 60 ; i++)
{
cout << menu_art[150] << endl;
}
return 0;
}
I need to do a program that reads a .txt file and stores it into a bidimentional character array and the show it in screen.
I have this code, but i dont know the conditional for the end of line in c++.
Basically i want to read a whole line and store it and then change the second index of the char matrix and read again, and so on, until the end of the file.
#include <iostream>
#include <fstream>
using namespace std;
int main() {
char menu_art[150][60];
ifstream fe("menu_art.txt");
for(int i=0 ; (menu_art end of line) ; i++)
{
fe.getline(menu_art[],150);
}
for(int i=0 ; i < 60 ; i++)
{
cout << menu_art[150] << endl;
}
return 0;
}