CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Aug 2012

    Convertinng Ascii to CString not working in VC6.0, working fine VS2008


    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!

    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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)