integer to character

This is a discussion on integer to character within the C++ Programming forums, part of the General Programming Boards category; Hi, I have a program where I am using an integer array. I had to get some character input from ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    57

    integer to character

    Hi,
    I have a program where I am using an integer array. I had to get some character input from the keyboard and store it in the integer array which worked fine since it stored it as the ascii integer. However, I now need to output the characters back to the screen but when I do a simple cout statement it obviously stays in the ascii integer. My question is........is there a way to output an integer in its ascii character form?

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    57
    nevermind, I found the answer on one of the articles

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    Check the answer against this C++ style cast:

    static_cast<char>(yourIntVal)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 05:55 PM
  2. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. mygets
    By Dave_Sinkula in forum C Programming
    Replies: 6
    Last Post: 03-23-2003, 06:23 PM
  5. Convert a character to integer (ex '1' to 1)
    By VanJay011379 in forum C++ Programming
    Replies: 11
    Last Post: 03-18-2003, 12:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21