First, some notes. You most likely aren't writing a DOS program. It's a windows program that runs in a console window. second, filenames mean nothing in the world of File IO. you could name the file in my examlpe 'Untitled1.exe' and it would still work perfectly fine. what you're looking for is called formatted data. the other type is binary data. formatted data can be read by a human and can be read in with the same functions you use with cin. binary data, on the other hand, has to be read in differently depending on the data type you wrote to the file in the first place. binary data files usually can't be read (or edited) directly by a human.
with that cleared up, here's some example code:
Code:
#include<iostream>
#include<fstream> //for file IO
int main()
{
char*info=new char[20];
std::fstream file("Untitled1.dat",std::ios::in); //open the file for read
for(register int i=0;i<3;i++) //loop around 3 times - 3 pieces of data
{
file.ignore(32000,'='); //ignore up to and including the first '=' encountered
file.getline(info,20,'\n'); //take in the rest of the line
std::cout<<info<<std::endl;
}
file.close(); //explicitly close the stream
std::cin.get();
return 0;
}
and the file I used:
Code:
processor=x86
OS=win2k
Compiler=GCC