Hey all,
i would really appreciate some help with abit of code i'm stuck on. I am trying to read data from text files in this way:
1. Open text file
2. Read in the first line from the text file that doesnt start with "/"
3. change this char to int
4. assign this int a name
5. find the next line in the text file that doesnt start with "/"
6. change this char to int
7. repeat steps 5 and 6 until the end of the text file
I am new enough to C++ and the problem I am having is once I have found the first line that doesnt start with "/" how do I set this as the new position to start looking for the next line that starts with "/"
What I have so far is:
char Input[256];
ifstream myfile ("CMPInput.txt");
while (! myfile.eof() )
{
myfile.getline (Input,100);
if (Input[0] != '/')
{
int ConDenRan1L = atoi(Input);
}
char Input1[256];
myfile.getline (Input1,100);
if (Input1[0] != '/')
{
int ConDenRan1H = atoi(Input1);
int test = ConDenRan1H - ConDenRan1L;
cout << "test = " << test << endl;
}
Seems as though I am starting from the start of the text file each time. Thanks in advance for your help.
Colm