Help with programming

Make comments, ask questions, or just complain about the software on this site. Or comment on any educational software.
Please note that by clicking on links that may appear in these posts that you may be leaving the Dale Harris Educational Software website and that the content of those sites is the sole resposibility of the authors of those sites.

Moderators:daleadmin, Dale Harris, Alan, Andrew

Post Reply
Guest
Help with programming

Post by Guest » Wed May 04, 2005 10:46 pm

Hello. I'm trying to write a program that pulls data from the stock table. I'm not that great a programmer, and am using C++. I'm stuck on the long integers as strings (eg. pieces sold, value sold). A search on the net revealed that in QB, the CVL$ function would get them back to something usable. The problem is that I can't find an equivalent function in C++.

So, I'm hoping that someone can explain to me how the MKL$ function encodes the data to the string, so I can figure out a way to reverse the process.

Thanks!

JF Mous
Forum Regular
Posts:19
Joined:Mon May 03, 2004 2:51 pm
Location:Antwerp/Belgium

Post by JF Mous » Thu May 05, 2005 6:58 am

Hi,

Well, it just serializes the seperate bytes of data to their equivalent ASCII code.
So, for a 4-byte numeric data type that contains the value 578 (=0x242), the bytes stored in memory are:
00000000 (=0)/ 00000000 (=0)/ 00000010 (=2)/ 01000010 (=66)

And so converts to a 4-byte string:
NULL char (ASCII 0) / NULL char (ASCII 0) / STX char (ASCII 2) / B (ASCII 66).


I hope this helps you...
I wouldn't read them from the file as a string, but directly as the data type you need.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests