Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
SnowHow 26-Jul-10 8:45am    
Is the unsigned char buffer dictated by the "requirements" ? I can see this causing you difficulty since the max int value in a single unsigned char is 255(0xFF). Is this a binary file or a text file?
molocho 26-Jul-10 10:15am    
Thanks a lot for your comment.
Well, i put this instruction just as an example, of course buffer must contain the whole text file. Long time ago I did programming in assembler so blocks of memory was easy to implement, as big as I want. Manipulating data inside this blocks was very easy, today, I don´t know how to do this with VC++. I did the same program I want to implement now, displaying boxes with coord x,y, inc and dec coords, sending data outside via paralell port into a microcontroller. All this made with MASM 611. I hope someone can give me some clues to start my job in VC++.
ThatsAlok 27-Jul-10 5:41am    
CStdioFile::Read, can help you read entire block in one go!

Use ifstream::open to open the file in read mode.
Use getline to read the file one line at a time.
Use strtok_s to split each line into X and Y with space as the delimiter.
 
Share this answer
 
I will try his way, thanks a lot
CARLOS
 
Share this answer
 
you can also check CStdioFile MFC class for accessing file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900