Whats up guys. I am new to programming and just started a week ago. I am doing this just for fun. I have a problem with a text file that i am trying to read in. I am able to read in the text file, i just need to know how to elminate some lines from the text file. So, this is what i am trying to do
example Text file ;
'Memory Loader
'DAte
'Time
000001
000002
000003
000004
000005
000006
000000
000000
'variables
012012
012021
020102
'variables
001201
What i am trying to do is read in this file and place only lines that have numbers "000001" into an array. i have set up two arrays to put the numbers in. the first 8 lines of "numbers" go into one array and the remaining numbers go into another array. My problem is i do not know how to ignore the lines of text ex. " 'variables " and so forth. Here is what i have so far and thank you very much for any help you can give thanks
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
ifstream in ("C:\\Documents and Settings\\HP_Administrator\\Desktop\\test.txt");
float registers[7];
int memory[4000];
int i;
int k;
int j;
for (i=0; i<8; i++)
in >> registers[i];
for (k=0; k<18; k++)
in >> memory[k];
cout << "Registers" << endl;
cout << "Register 1 " << registers[0] << endl;
cout << "Register 1 " << registers[1] << endl;
cout << "Register 1 " << registers[2] << endl;
cout << "Register 1 " << registers[3] << endl;
cout << "Register 1 " << registers[4] << endl;
cout << "Register 1 " << registers[5] << endl;
cout << "SP " << registers[6] << endl;
cout << "PC " << registers[7] << endl;
cout << "Memory Dump" << endl;
for (j=0; j<18; j++)
cout << memory[j] << endl;
in.close();
system("PAUSE");
return EXIT_SUCCESS;
}