-
September 22nd, 2012, 08:40 AM
#1
Convertinng Ascii to CString not working in VC6.0, working fine VS2008
Hi!
The below code is working fine in VS2008 and not working in VC6.0 (taking garbage values)
this code is for converting hex values to string.
sending Input string is : 727332333263 required output: rs232c
DWORD AsciiToString(LPCTSTR f_chInputChar, LPTSTR f_chOutputChar)
{
long ch;
int i,j;
TCHAR tmp[2];
int len = _tcslen(f_chInputChar);
for(i = j= 0; i < len; i += 2, j++){
memset(tmp, NULL, 2);
tmp[0] = f_chInputChar[i];
tmp[1] = f_chInputChar[i+1];
ch = _tcstol(tmp, NULL, 16);
f_chOutputChar[j] = (TCHAR)ch;
}
return TRUE;
}
Please suggest the required changes.
Thanks in advance to all!
regards
sam.
Last edited by mr.sam1024; September 22nd, 2012 at 08:42 AM.
Tags for this Thread
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
|