Answer the question
In order to leave comments, you need to log in
Read file as stream and write to 2D array?
There is a source text file input.txt, you need to read the entire contents of the file as a stream and throw it into a two-dimensional array. I tried to do this but I only read the first line
char line [5][20];
int count=0;
fstream fIn;
fIn.open("input.txt",ios::in);
while(fIn.getline(line[count],20))
count++;
Answer the question
In order to leave comments, you need to log in
+1 to nirvimel , but it's more common to see references in method and function signatures. And here, roughly speaking, this code makes it easier to read and allows you to write just l instead of lines[n%N] .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question