Hi,
I wrote a function where I want to read 2 lines from a file. Each line will be soimething like
A + B - C
A - B + A - D - F
etc
I wrote a function as follows:
I can't see whats wrong with it. I want the FloppyData array to hold two strings, then assign Infix and Pre to the right values in the array.Code:void GetData(string& Infix, string& Pre) { ifstream ins; ins.open("data.txt"); char buffer[80]; 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]; }
Thanks in advance for any feedback.




Reply With Quote