Thread: int to char. please help.

  1. #1
    Unregistered
    Guest

    int to char. please help.

    i have an int. it's value is 10 for instance. i need to convert that to a char. so i use the code:

    char mychar = (char) intname;

    now i need to append mychar to the end of another char but it doesn't work.

    could somebody help me?

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Why not look up itoa? its prototype is:

    Code:
    char* itoa(int num, char* buffer, int radix);
    num is the number you want to convert, buffer is where your store the result, and radix is the numbers base, e.g. 2 Binary, 8 Octal, 10 Decimal, 16 Hexadecimal
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  3. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  4. Game Won't Compile
    By jothesmo in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2006, 04:24 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM