Thread: How to see all ASCII characters on Turbo C++ compiler output window?

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    1

    How to see all ASCII characters on Turbo C++ compiler output window?

    I have the following code for which I need to no explanation,the doubt is about the seeing the output of all the 256 characters together or page up - page down manner on output window of Turbo C++ compiler.Here is the code to print the ASCII character.
    By the way I was told by my teacher about how to view them ,sadly I forgot ,would like some help from you guys :)
    Code:
    #include<stdio.h>
    int main()
    {
    int ch;
    for(ch=0;ch<=255;ch++)
    printf("%d%c\n",ch,ch);
    return 0;
    }

  2. #2
    Registered User
    Join Date
    Sep 2012
    Posts
    11
    you can use getchar() to wait for you to hit return, giving you the chance to see the output before the window closes.

    Code:
    
    
    Code:
    #include <stdio.h>
    
    int main()
    {
    int ch;
    
    for(ch = 0; ch < 255; ch++)
    printf("%c\n",ch);
    
    getchar();
    
    }
    

    Last edited by mark707; 09-18-2012 at 08:29 AM.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    since many of the characters in from 0-255 are not printable, things like backspace, tab, and most everything less than 32, a way to show them all is something like this:

    Code:
    #include <ctype.h>
    ....
       if (isprint(ch)) {
          // character is printable, print it
          printf("%c\n",ch);
       }
       else {
          // character is not printable, print its value instead (use whatever format you like)
         printf("[%d]\n",ch);
       }

  4. #4
    Registered User
    Join Date
    Sep 2012
    Posts
    357
    If you're using Turbo C++, you're probably using a DOS windows too...
    Just call the program and filter the output to "more"

    Code:
    > tcc test.c
    ... ...
    ...
    > test | more

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Sorry, I stopped reading and started laughing when I read "Turbo C++".
    Oh man, there I go again just wirting it...
    You know that software is probably older than you are right?

    Did I just slip through a wormhole and come out in the early 90's? Hmm nope, not unless I took Visual Studio 2012 back with me.

    Note that this is an exaggerated but typical response by most programmers outside of india.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  6. #6
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by iMalc View Post
    Note that this is an exaggerated but typical response by most programmers outside of india.

    I'm happy with GCC 4.7 and llvm/clang 3.2.

  7. #7
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Quote Originally Posted by manasij7479 View Post

    I'm happy with GCC 4.7 and llvm/clang 3.2.
    Good for you. To bad you don't run the universities in India.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by iMalc View Post
    Sorry, I stopped reading and started laughing when I read "Turbo C++".
    Oh man, there I go again just wirting it...
    You know that software is probably older than you are right?

    Did I just slip through a wormhole and come out in the early 90's? Hmm nope, not unless I took Visual Studio 2012 back with me.

    Note that this is an exaggerated but typical response by most programmers outside of india.
    Visual Studio 2012 will suck the life out of you. It is devoid of life, to such an extent that it needs to suck out of life out of its users to sustain itself.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Quote Originally Posted by Elysia View Post
    Visual Studio 2012 will suck the life out of you. It is devoid of life, to such an extent that it needs to suck out of life out of its users to sustain itself.
    So what do you really think... Don't sugar coat it.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  10. #10
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by WaltP View Post
    Good for you. To bad you don't run the universities in India.
    Let's see if I can... after a decade or so.

  11. #11
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by iMalc View Post
    Oh man, there I go again just wirting it...
    Turbo C++...You know that software is probably older than you are right?

    Did I just slip through a wormhole and come out in the early 90's? ...
    Yes, you did, and welcome, to my

    Twilight Zone of Turbo C++!

    Ha, ha, ha, ha, ha!

    Suffer!! <big evil grin>

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Split Output Window in Turbo c3
    By tronixstar7 in forum C Programming
    Replies: 1
    Last Post: 02-09-2009, 04:37 AM
  2. Replies: 2
    Last Post: 02-04-2008, 02:34 AM
  3. Please help to install Turbo C compiler..
    By Shidlingayya in forum C Programming
    Replies: 6
    Last Post: 08-15-2007, 09:08 AM
  4. Turbo C compiler
    By ssharish2005 in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 01-02-2007, 06:41 PM
  5. Turbo C Compiler
    By thomas in forum C Programming
    Replies: 2
    Last Post: 09-09-2001, 10:55 AM