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.
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.
Bookmarks