print output

Discussion in 'C Programming' started by aarklon@gmail.com, Apr 9, 2008.

  1. Guest

    Hi all,

    Is it possible to write a C program to print o/p without using library
    functions( in standard C )..????
    , Apr 9, 2008
    #1
    1. Advertising

  2. In article <>,
    <> wrote:

    >Is it possible to write a C program to print o/p without using library
    >functions( in standard C )..????


    On -some- implementations.

    There are some implementations that have memory-mapped I/O --
    writing a byte to a particular address causes the byte to be sent
    to I/O (e.g., to a serial port or to a printer or whatever.)

    Standard C does not -promise- that there is any way to write
    data to a particular absolute address, but Standard C says that
    it is implementation defined as to what the meaning is of converting
    an integral value into a pointer. Hence an implementation is
    allowed to define the conversion of magic absolute I/O addresses
    into valid pointers to write to and thus to potentially trigger I/O.

    Any program that used this technique would not be portable
    to any other system that did not use memory-mapped I/O, or which
    used different addresses for memory-mapped I/O, or to any system
    that had memory-protection that prevented users from writing to
    the magic addresses -- and of course it would not be portable to
    any system that basically defines the result of converting an
    integral value to a pointer as creating a useless junk pointer.
    But any program that used this technique successfully for
    a specific system would not be violating any constraint in C.

    The ability to create arbitrary pointers is fairly common in C
    implementations -- the C standard doesn't promise it will work
    though.

    --
    "There is no greater calling than to serve your fellow men.
    There is no greater contribution than to help the weak.
    There is no greater satisfaction than to have done it well."
    -- Walter Reuther
    Walter Roberson, Apr 9, 2008
    #2
    1. Advertising

  3. Default User Guest

    wrote:

    > Hi all,
    >
    > Is it possible to write a C program to print o/p without using library
    > functions( in standard C )..????


    Why do you want to?




    Brian
    Default User, Apr 9, 2008
    #3
  4. In article <>,
    Default User <> wrote:
    > wrote:


    >> Is it possible to write a C program to print o/p without using library
    >> functions( in standard C )..????


    >Why do you want to?


    When I gave my reply earlier, I assumed that it yet another
    "job interview" type question.

    Now, 25 years ago, I had real reasons for wanting to know similar
    information, as I was working on a multiuser 128 Mb system with no
    shared libraries, and being able to omit the C library from the
    (static) link meant a (relatively) major reduction in executable size.
    --
    "Walter is a great man." -- Dennis Green
    Walter Roberson, Apr 9, 2008
    #4
  5. Default User Guest

    Walter Roberson wrote:

    > In article <>,
    > Default User <> wrote:
    > > wrote:

    >
    > >> Is it possible to write a C program to print o/p without using

    > library >> functions( in standard C )..????
    >
    > > Why do you want to?

    >
    > When I gave my reply earlier, I assumed that it yet another
    > "job interview" type question.
    >
    > Now, 25 years ago, I had real reasons for wanting to know similar
    > information, as I was working on a multiuser 128 Mb system with no
    > shared libraries, and being able to omit the C library from the
    > (static) link meant a (relatively) major reduction in executable size.


    That's the reason for the "why?". If it's curiosity versus a real need,
    then the answers may vary.




    Brian
    Default User, Apr 9, 2008
    #5
  6. Guest

    On Apr 9, 5:24 pm, "Default User" <> wrote:

    >
    > That's the reason for the "why?". If it's curiosity versus a real need,then the answers may vary.


    as walter roberson said,

    When I gave my reply earlier, I assumed that it yet another
    "job interview" type question.

    this exactly is the reason
    , Apr 10, 2008
    #6
    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. Bad_Kid
    Replies:
    3
    Views:
    3,933
    Shawn H. Mesiatowsky
    Apr 7, 2005
  2. Bryan Shaw

    Lock Print Screen and File Print

    Bryan Shaw, Apr 19, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,933
    Kevin Spencer
    Apr 20, 2005
  3. keto
    Replies:
    0
    Views:
    897
  4. Lew
    Replies:
    0
    Views:
    625
  5. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    335
    David Cournapeau
    Dec 30, 2008
Loading...

Share This Page