home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1977
Discussions: 188,394, Posts: 2,243,581, Members: 232,624
Old February 16th, 2004, 04:10 PM   Digg it!   #1 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 6,163
Send a message via ICQ to Creatures
C++ reading from file...

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

Creatures is offline   Reply With Quote
Old February 17th, 2004, 05:32 PM     #2 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 6,163
Send a message via ICQ to Creatures
little bump

Creatures

Creatures is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2904)
Unarmed man on his stomach shot by .. (5)
New Build ( Finally ) (6)
3-days in and no threads about Gaza (160)
Building a gaming computer advice (5)
CPU wont boot (7)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (444)
Upgrading RAM (6)
Recent Discussions
Sporadic internet connectivity (2)
Assassins Creed PC Problems (40)
I think my PSU is dieing (1)
Left 4 Dead Small Freezes (2)
building a gaming computer, inp.. (0)
Iming and surfing slowed down (3)
Laptop proccesor to desktop mob.. (0)
Please help! multiple problems! (3)
Install Problem for Windows Def.. (1)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 02:18 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28