Hi,
I don't know much about C++, so here's an easy one for you:
I have a file from which I want to read through line by line and if the line meets certain criteria, I want to put it into an array.
1) How do you do that in C++? I don't know how long the array should be, can you change the length of an array at runtime? Or please suggest better solution.
2) Is this the best (=fastest, my file is VERY large) way to read through the file?
-------------------------------------------
ifstream inFile("c:\tmp\test.txt"
String inStr;
while(!inFile.eof())
{
getline(inFile,inStr);
if (inStr[78]="0" && inStr[79]="J" {
//Add the line to the array
}
}
------------------------------------------
Thank you in advance
Sunaj
I don't know much about C++, so here's an easy one for you:
I have a file from which I want to read through line by line and if the line meets certain criteria, I want to put it into an array.
1) How do you do that in C++? I don't know how long the array should be, can you change the length of an array at runtime? Or please suggest better solution.
2) Is this the best (=fastest, my file is VERY large) way to read through the file?
-------------------------------------------
ifstream inFile("c:\tmp\test.txt"
String inStr;
while(!inFile.eof())
{
getline(inFile,inStr);
if (inStr[78]="0" && inStr[79]="J" {
//Add the line to the array
}
}
------------------------------------------
Thank you in advance
Sunaj