-
October 20th, 2008, 04:58 AM
#1
to read a .xml file
In my program,I have to read the contents from a file(.map.xml) by line by line.
While I tried it by copying it to a CStringlist, the data got end on each spaces... But I have to read it on line by line.Is thr any way to trim it?
Plz get me code..
-
October 20th, 2008, 06:14 AM
#2
Re: to read a .xml file
Why can't you just use Microsoft XML parser ?
Regards,
Ramkrishna Pawar
-
October 28th, 2008, 01:52 AM
#3
Re: to read a .xml file
Nop...
because, in my program-to add a new feature,I wanna take some parts of data from a xml file... Every time,when the program runs the xml file will not be same..So the user should download the xml file which he want to run. tats wy-as a programmer-I need this file to open and read..
So plz tell me a suit form to open n readthis xml file till end of line..(better I shd read line by line format)..... Help me plz.
Arun
-
October 28th, 2008, 02:22 AM
#4
Re: to read a .xml file
I'm not sure what you want to do exactly.
You will eventually need to parse the xml code, wouldn't you?
But you can always use fread to read to a stream from a file.
for example:
Code:
result = fread (buffer,1,size,file);
You can also use this example to read file into a stream
http://www.cplusplus.com/reference/c...dio/fread.html
You just divided by zero, didn't you?
-
October 28th, 2008, 10:06 AM
#5
Re: to read a .xml file
Originally Posted by arunkr6
Nop...
because, in my program-to add a new feature,I wanna take some parts of data from a xml file... Every time,when the program runs the xml file will not be same..So the user should download the xml file which he want to run. tats wy-as a programmer-I need this file to open and read..
So plz tell me a suit form to open n readthis xml file till end of line..(better I shd read line by line format)..... Help me plz.
Arun
You still should use the Xml parser to read the file. After all, that's what an xml parser does - it reads xml. It really shouldn't matter what the xml contains because as long as it's valid xml, the parser is going to be able read it better than your hand written code.
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
|