I/O to binary file
short int duration,
This will add up to 256 bytes so the recordset is 256 in the binary
when the program starts it opens the binary file it it has to read all the records into a dynamic string.
ifstream infile("m.dat", ios::in | ios::out | ios::binary);
fsize = infile.tellg();
current = new char[fsize];
my problem is that when i copy the records into the string it will not hold the spaces.
What i mean is if the first ten spaces in name from binary has "jjjjjjjjjj" and the rest of the 51 spaces are empty.
i want the string current to hold "jjjjjjjjjj" + 51 spaces;
How can i do that;
this is a console app on win. using borland
Did you use write() to write the records? Assuming you filled name with 10 characters + 50 spaces using strcpy() or at the declaration, when you read it back using infile.read() it will contain the spaces.
However there is only room for 50 spaces, not 51, as the string terminator takes one space.
I'm having problems with files myself, but don't know if you can open an ifstream with ios::out. Never seen it, anyway.