I have some texts files, which i want to read in each line, and then
write back each line to a new text file.
So for example, I want to read in the 2 lines below:
"C:\Data\ÓêÒ¹ÐÇ¿Õ",6,10,3,3,8
"",0,0,0,318.592,83.04552
I store each line of data in the following vector:
std::vector<CStringFileData;
So FileData[0] = ""C:\Data\ÓêÒ¹ÐÇ¿Õ",6,10,3,3,8"
FileData[1] = """,0,0,0,318.592,83.04552"
(the data is in the vector correctly)
Then I go to write the data to a new text file...
FILE * stream;
stream = _wfopen(filename, _T("w"));
for(j=0;j<FileData.size();j++)
fwprintf(stream, _T("%s"), FileData[j]);
fclose(stream);
However, when I look at the text file, it's gone wrong:
C:\Data\,0,0,0,318.592,83.0455
I'm doing this in unicode. Is there any obvious problem? 1 1696
hamishd wrote:
I have some texts files, which i want to read in each line, and then
write back each line to a new text file.
So for example, I want to read in the 2 lines below:
"C:\Data\ÓêÒ¹ÐÇ¿Õ",6,10,3,3,8
"",0,0,0,318.592,83.04552
I store each line of data in the following vector:
std::vector<CStringFileData;
So FileData[0] = ""C:\Data\ÓêÒ¹ÐÇ¿Õ",6,10,3,3,8"
FileData[1] = """,0,0,0,318.592,83.04552"
(the data is in the vector correctly)
Then I go to write the data to a new text file...
FILE * stream;
stream = _wfopen(filename, _T("w"));
for(j=0;j<FileData.size();j++)
fwprintf(stream, _T("%s"), FileData[j]);
fclose(stream);
However, when I look at the text file, it's gone wrong:
C:\Data\,0,0,0,318.592,83.0455
I'm doing this in unicode. Is there any obvious problem?
Other than std::vector, FILE and fclose, none of this appears to be
Standard C++.
May I suggest you ask in an MFC group? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: matt |
last post by:
I have compiled some code, some written by me, some compiled from
various sources online, and basically i've got a very simple flat file
photo gallery. An upload form, to upload the photos and give...
|
by: tjshadyluver |
last post by:
ok i have gotten this damn project almost done but i am frustrated on
this one step. getting 18-35 together and 36-50 and so on. here is my
code how can i get them combined in one line instead of...
|
by: Richard Tierney |
last post by:
To create help output (the response to "myprog --help", for example) I
currently create a big .h file, which includes a single string, such
as:
static char *help_text = "\
myprog: my program\n\...
|
by: James Radke |
last post by:
Hello,
I have a multithreaded windows NT service application (vb.net 2003) that I
am working on (my first one), which reads a message queue and creates
multiple threads to perform the processing...
|
by: Yunus's Group |
last post by:
Yunus's Group May 23, 3:36 pm show options
Newsgroups: microsoft.public.dotnet.languages.vb
From: "Yunus's Group" <yunusasm...@gmail.com> - Find messages by this
author
Date: 23 May 2005...
|
by: Rahul |
last post by:
Hi Everybody
I have some problem in my script. please help me. This is script file.
I have one *.inq file. I want run this script in XML files. But this
script errors shows . If u want i am...
|
by: felixnielsen |
last post by:
What i really wanna do, is defining my own types, it doesnt really
matter why.
Anyway, i have run into some problems
1)
typedef unsigned short U16;
U16 test = 0xffffffff; // There should be a...
|
by: bmruze |
last post by:
Hello, I'm pretty new at trying to do things in visual basic and I've been following some steps to do a few things like writing to a .txt file and reading from that same .txt file.
Link for writing...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |