|
-
February 18th, 2007, 12:10 PM
#1
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
-
February 18th, 2007, 01:28 PM
#2
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).
ZDF
What is good is twice as good if it's simple.
"Make it simple" is a complex task.
-
February 23rd, 2007, 09:05 PM
#3
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|