-
July 25th, 2010, 08:37 PM
#1
Read text file in VC++
Hello every one,
I am new in C++ and I have a new project.
I have a text file with numbers that are coordinates x,y
The text files´s format looks like this:
X Y
234 5678
243 3456
193 235
1234 345
and so on
Steps,
1.- Put all this file in a buffer memory (unsigned char inbuffer [2000],
2.- Display each two coordinates in two text box one for X and one for Y (I dont´t know how to do this)
3.- inbuffer [0] = outbuffer[0]
inbuffer [1] = outbuffer[1]
4.-increment inbuffer + 2 for next two coordinates
5.-Put this data in USB (Resolved)
6.-Microcontroller sends ready bit to receive more data (resolved)
7.-Repeat from step 2 until all data is sended.
I really appreciate your help with a little code.
Regards
Carlos
-
July 25th, 2010, 09:37 PM
#2
Re: Read text file in VC++
-
July 25th, 2010, 11:53 PM
#3
Re: Read text file in VC++
You can use fstream to read text file that will be even easy and simple.
Code:
ifstream fileRead("your file");
while ( ! fileRead.eof() )
{
/** Do your stuffs here **/
}
In the stuff part you need to manipulate text file reading as per your need. Like you can read line by line in char* by getline() and break into two char* if a space found ie: the delim of getline() and if '\n' found go to next line and read it, and so on, using a loop.
-
July 26th, 2010, 07:00 PM
#4
Re: Read text file in VC++
Thanks for your reply, but can you tell me where the file is stored?
-
July 26th, 2010, 09:50 PM
#5
Re: Read text file in VC++
Sig-na-tju-(r)
-
July 27th, 2010, 12:34 AM
#6
Re: Read text file in VC++
Which file. No file is storing here. You need to input file name, the file you want to read
Tags for this Thread
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
|