Einzelnen Beitrag anzeigen
Alt 12.02.2006, 17:47   #2
Biri
Hero
 
Registriert seit: 04.09.2001
Beiträge: 894


Standard

Getline:

Get a line from stream.
Extracts characters from the stream and stores them into successive locations in the array pointed by s.
Characters are extracted until either (n - 1) characters have been extracted, the delimiter (parameter delim or '\n' if not specified) is found, or if the end of file or any error occurs in the input sequence.
If the delimiter is found it is extracted but not not stored. Use get if you don't want this character to be extracted.
An ending null character is automatically appended after the data stored in s.

PHP-Code:
 #include <fstream.h>
    
int main()
    {
        
char str[2000];
        
fstream file_op("c:\\test_file.txt",ios::in);  // textdatei öffnen
        
while(!file_op.eof())  // solange nicht dateiende
        
{
              
file_op.getline(str,2000);  // Zeile einlesen, max. 2000 zeichen oder bis zum 1. "\n"
              
cout <<str;  // gelesene zeile ausgeben
        
}         file_op.close();
        
cout <<endl;
        return 
0;
    } 
alles klar?
...ist aber nicht sooo schwer in den weiten des internets zu finden.

fg
-hannes
Biri ist offline   Mit Zitat antworten