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:


234 5678
343 3456
193 235

and so on


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.


What are you using for a windowing library ("...in two text box")? (e.g., Win32 API, MFC, CLR-Winforms, Qt)

The main program is win 32

Okay. I'm not well versed in that but hopefully but there are a few folks around that will be able to. Apologies that I couldn't help!

To read in a file, you can use ifstream:

ifstream file("filename",ios::binary|ios::ate);
  if (!file.is_open())return 1; /*failed to open file*/
  const int fsize=file.tellg();

  unsigned char buffer[2000];
  if (file.fail())return 1; /*failed to read file*/

To convert the strings into numbers, you can use stringstream or just use ifstream directly (then reading the data into the buffer would be pointless though).

About the edit boxes... is VC++ a RAD environment? Or in other words... can you select components like text boxes and insert them into your window?

If you are using VC++ 2010 (or 2008) you can create CLR Forms application in which you can easily create text boxes to display the information from the file. google for clr tutorials and you will find out how to do that.

I though you said the program reads the data from a text file. But with #6 I'm not so sure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.