Using MS Embedded V4.0, C++, Can't get toascii to work RRS feed

  • Question

  • Converting a older C pgm to MS embedded C ++. It uses toascii macro.
    Tried toascii and __toascii with no luck. Compiler says functon not defined.

    Need to have a funtion to convert a int to a ascii char.

    to ascii would be nice as it makes sure the chr is a valid ascii car (1-127)

    Thanks for the help,

    • Edited by ibmleeboy Friday, February 19, 2010 8:51 PM
    • Moved by Rong-Chun Zhang Tuesday, February 23, 2010 10:01 AM WinCE issue (From:Visual C++ Language)
    Friday, February 19, 2010 4:40 AM

All replies

  • __toascii is define in ctype.h. Did you include it?
    You could also try char c = (char)i;

    Microsoft MVP (Visual C++)
    Friday, February 19, 2010 4:52 AM
  • Yes,
    here is my includes:

    #include <string.h>
    #include <stdlib.h>
    #include <ctype.h>
    #include "cfrapi24.h" // for IBM applcation
    #include "cfrutl24.h" // for IBM application
    #include "cfrwin32.h"  //for IBM application

    Friday, February 19, 2010 8:54 PM
  • ctype.h has this data in it:

    // Copyright (c) Microsoft Corporation.  All rights reserved.
    // Use of this source code is subject to the terms of the Microsoft end-user
    // license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
    // If you did not accept the terms of the EULA, you are not authorized to use
    // this source code. For a copy of the EULA, please see the LICENSE.RTF on your
    // install media.
    #include "stdlib.h"

    Does not look complete???
    Friday, February 19, 2010 9:25 PM
  • I browsed the 'ToAscii' function in MSDN and found the below. are you linking to user32.lib? 

    Header Declared in Winuser.h, include Windows.h
    Import library User32.lib
    Friday, February 19, 2010 9:47 PM
  • Remember I an using Microsoft eMbedded C++ for widows CE platform

    Friday, February 19, 2010 10:09 PM
  • Still trying to figure this out...I hope that toascii was not left out of the compiler??

    Any ideas?
    Saturday, February 20, 2010 5:10 PM