All I did to get your code working is specified an absolute path to the file
Code:#include "iostream" #include "string" #include "fstream" using namespace std; void GetData(string& Infix, string& Pre) { ifstream ins("c:\\data.txt"); int Count = 0; // Counter used to update position in array where we are saving the floppies contents to. string data; string FloppyData[2]; while(!ins.eof()){ getline(ins,data); FloppyData[Count] = data; Count++; } Infix = FloppyData[0]; Pre = FloppyData[1]; } int main() { string i,p; GetData(i,p); cout << i << endl; cout << p; system("Pause"); return 0; }


