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!
Help with programming
Moderators:daleadmin, Dale Harris, Alan, Andrew
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.
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.
Who is online
Users browsing this forum: No registered users and 21 guests