|
-
March 22nd, 2005, 08:44 AM
#1
string copy truncation
I have the following:
Code:
char cmdSQL[256];
int stLen = 0;
stLen = sprintf(cmdSQL,"updatemachineData_h '%s','%s',%d,%d,'%s',
'%s',%f,%f,%f,%d,%d,%f,%f,%f,%f,%f,'%s'",
nbr1, nmid1, ntme, njdt, nlitm1, naitm1, ncyc, na10, njobavg ,
nshftprd, njobprd, nhrsup, nruneff, ncyceff, nneteff, nshot, nstat1);
_bstr_t sndSQL = (_bstr_t)cmdSQL;
After the sprintf command, the string length is 186 and the CORRECT output is:
Code:
updatemachineData_h 'RKR ','020',83300,105081,'01-00300-0350','C400 CU BL 4928TW (VL) '
,7.987000,7.987000,7.900000,7968,749272,2.185000,100.000000,
100.964066,1.439381,2.660000,'03000 '
When I try to pass this to the _bstr_t variable sndSQL, it gets truncated to:
Code:
updatemachineData_h 'RKR ','020',83300,105081,'01-00300-0350','C400 CU BL 4928TW (VL) '
,7.987000,7.987000,7.900000,7968,7492
I have been trying to see what the limit is for the _bstr_t data type and also how to handle this, but need a push in the right direction.
Any help??
There are 10 types of people in the world, those that understand binary and those that don't. 
Using VS 2010
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|