February 16th, 2004, 04:10 PM
|
#1 (permalink)
|
| Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 6,163
|
ok i just created this little program: Code: #include <iostream>
#include <fstream>
#include <string> using namespace std;
int main()
{
char buffer[255], file[255], text[255];
cout << "Filename: ";
cin.getline( buffer , 255);
strcpy(file, buffer);
cout << "Text: ";
cin.getline( buffer,255);
strcpy(text, buffer);
system("pause");
ofstream oFile(file,ios::app);
if (! oFile)
{
cout << "Somethings wrong..." << endl;
return -1;
}
oFile << text << endl;
oFile.close();
return 0;
} this program creates always a new line and inserts the char text, now i want to read and output just one of those lines, but i have no idea how i should do this
i thought about adding a sign at the end of each line to mark new lines, but i donnu how to find this mark again!
can anyone help?
Creatures
__________________ Canon EOS 450D | Canon EF-S 18-55mm 1:3.5-5.6 IS | Canon EF-S 55-250mm 1:4-5.6 IS | Canon Speedlite 430EX II |
| |