Re: detecting ASCII/EBCDIC

Discussion in 'C Programming' started by Antoninus Twink, Sep 2, 2008.

  1. On 2 Sep 2008 at 22:11, Pilcrow wrote:
    > Is there a way that a proram can detect whether it is operating in an
    > ASCII or an EBCDIC environment?


    #include <stdio.h>
    #include <time.h>

    int main(void)
    {
    time_t t;
    time(&t);
    if(gmtime(&t)->tm_year > 75)
    puts("ASCII!");
    return 0;
    }
    Antoninus Twink, Sep 2, 2008
    #1
    1. Advertising

  2. On 2 Sep, 23:25, Antoninus Twink <> wrote:
    > On 2 Sep 2008 at 22:11, Pilcrow wrote:


    > > Is there a way that a proram can detect whether it is operating in an
    > > ASCII or an EBCDIC environment?

    >
    > #include <stdio.h>
    > #include <time.h>
    >
    > int main(void)
    > {
    > time_t t;
    > time(&t);
    > if(gmtime(&t)->tm_year > 75)
    > puts("ASCII!");
    > return 0;
    > }


    despite what twink implies I believe EBCDIC machines do still
    exist. The IBM mainfram world is still alive and well.


    --
    Nick Keighley
    Nick Keighley, Sep 3, 2008
    #2
    1. Advertising

  3. Antoninus Twink

    Richard Guest

    Nick Keighley <> writes:

    > On 2 Sep, 23:25, Antoninus Twink <> wrote:
    >> On 2 Sep 2008 at 22:11, Pilcrow wrote:

    >
    >> > Is there a way that a proram can detect whether it is operating in an
    >> > ASCII or an EBCDIC environment?

    >>
    >> #include <stdio.h>
    >> #include <time.h>
    >>
    >> int main(void)
    >> {
    >> time_t t;
    >> time(&t);
    >> if(gmtime(&t)->tm_year > 75)
    >> puts("ASCII!");
    >> return 0;
    >> }

    >
    > despite what twink implies I believe EBCDIC machines do still
    > exist. The IBM mainfram world is still alive and well.


    Yes. But one has to wonder how many routines written by people looking
    for help here will end up running on them....
    Richard, Sep 3, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sylvain

    EBCDIC ascii conversion?

    Sylvain, Jun 13, 2004, in forum: Java
    Replies:
    2
    Views:
    21,816
    Thomas Weidenfeller
    Jun 14, 2004
  2. Re: detecting ASCII/EBCDIC

    , Sep 2, 2008, in forum: C Programming
    Replies:
    3
    Views:
    385
  3. Keith Thompson

    Re: detecting ASCII/EBCDIC

    Keith Thompson, Sep 3, 2008, in forum: C Programming
    Replies:
    2
    Views:
    325
    Keith Thompson
    Sep 3, 2008
  4. Re: detecting ASCII/EBCDIC

    , Sep 3, 2008, in forum: C Programming
    Replies:
    4
    Views:
    379
  5. Jean-Marc Bourguet

    Re: detecting ASCII/EBCDIC

    Jean-Marc Bourguet, Sep 3, 2008, in forum: C Programming
    Replies:
    7
    Views:
    428
    osmium
    Sep 4, 2008
Loading...

Share This Page