-
Borland C++
Im trying to read from a file using Borland C++ but im haveing a problem reading from a file
Code:
int TForm1::LoadFile()
{
ifstream filein;
string inchar;
memblock;
filein.open("FileCabenet\\StockUpdates\\datalink.txt");
while (filein.good())
{
filein >> inchar;
memblock.append(inchar);
}
filein.close();
return 1;
}
Code:
The File
"PRICE","PRODUCT_CODE","STOCK_AVAILABLE","CATEGORY_TIER1","CATEGORY_TIER2","CATEGORY_TIER3","SHORT_DESCRIPTION","LONG_DESCRIPTION","WEB_LINK","WEIGHT"
The Problem I’m having when I read in it adds a \ in front of the " and i cant work out why
-
Re: Borland C++
Hello,
I assume:
Code:
string inchar;
memblock;
should be:
Code:
string inchar, memblock;
I reckon you did not post the actual code. The code you posted (with the above correction) works fine on my compiler (VC7).
-
Re: Borland C++
yeah sorry memblock is defined else where in the code.
The Problem im havening is Borland C++ 6 seems to be adding lines to the data not sure if its when im reading it in or saving it out to the file but when ever there is a \n in my file when i save it it adds a \r in front
so
Save one File is Fine
Save two and \n now = \r\n
save three "\r\r\n"
save four "\r\r\r\n"
Haven got a clue why it is doing this can anyone help?