Adding a data file to my compiled program

  • Azima

    Azima - 2011-04-19

    Currently using Dev C++ and I was wondering how do I go about adding a data
    file to my program. I created the data file and don't know how to link the two
    together. I tried using a project folder and I put the .cpp and the .txt with
    in the folder but it still doesn't notice it. I'm oviously missing a step or
    two. Maybe even three! Please someone save me. My instructor wants me to use



    using namespace std;
    ifstream fin("");
    while(fin>>employeeid>>hoursworked>>hourlyrate){..........}//end of loop

  • GReaper

    GReaper - 2011-05-31

    Simple, add it as resource.

  • Aris

    Aris - 2012-04-28

    ifstream fin(""); makes an ifstream object and a stream between name of the file) and fin(the name of the object)

    fin>>employeeid>>hoursworked>>hourlyrate; insert 3 first values in the file
    to, employeeid hoursworked hourlyrate...

    If off course is a text file. if it is a binary you must use read
    and write functions.

    the must be to the same folder with the .exe of your prgramm


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks