Re: Simple Parser

Discussion in 'C Programming' started by Bill Cunningham, Apr 11, 2004.

  1. > I recommend getc and putc, using real FILE* objects which you can
    > test by setting them to stdin and stdout in main(). Example:
    >
    >
    > int process_stream(FILE *in, FILE *out);
    >
    > int main()
    > {
    > process_stream(stdin, stdout);
    > return 0;
    > }
    >

    I tried this code with djgpp and it wouldn't compile. Does it compile
    for you?

    Bill
     
    Bill Cunningham, Apr 11, 2004
    #1
    1. Advertising

  2. Bill Cunningham <> scribbled the following:
    >> I recommend getc and putc, using real FILE* objects which you can
    >> test by setting them to stdin and stdout in main(). Example:
    >>
    >> int process_stream(FILE *in, FILE *out);
    >>
    >> int main()
    >> {
    >> process_stream(stdin, stdout);
    >> return 0;
    >> }
    >>

    > I tried this code with djgpp and it wouldn't compile. Does it compile
    > for you?


    No, nor should it. The function process_stream is declared but never
    defined. Obviously this was intended to be compiled along with another
    file, which defines the function.

    --
    /-- Joona Palaste () ------------- Finland --------\
    \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
    "Show me a good mouser and I'll show you a cat with bad breath."
    - Garfield
     
    Joona I Palaste, Apr 11, 2004
    #2
    1. Advertising

  3. On Sun, 11 Apr 2004, Joona I Palaste wrote:
    >
    > Bill Cunningham <> scribbled the following:
    > >> I recommend getc and putc, using real FILE* objects which you can
    > >> test by setting them to stdin and stdout in main(). Example:
    > >>
    > >> int process_stream(FILE *in, FILE *out);
    > >>
    > >> int main()
    > >> {
    > >> process_stream(stdin, stdout);
    > >> return 0;
    > >> }
    > >>

    > > I tried this code with djgpp and it wouldn't compile. Does it compile
    > > for you?

    >
    > No, nor should it. The function process_stream is declared but never
    > defined. Obviously this was intended to be compiled along with another
    > file, which defines the function.


    And, of course, #including at least <stdio.h>, for the FILE stuff.
    Bill knows this -- the giveaway is that he knows how to invoke DJGPP.
    I doubt anyone who uses a compiler regularly is really ignorant of the
    need to define functions that are supposed to get used. :)

    -Arthur
     
    Arthur J. O'Dwyer, Apr 11, 2004
    #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. Bernd Oninger
    Replies:
    0
    Views:
    790
    Bernd Oninger
    Jun 9, 2004
  2. ZOCOR

    XML Parser VS HTML Parser

    ZOCOR, Oct 3, 2004, in forum: Java
    Replies:
    11
    Views:
    845
    Paul King
    Oct 5, 2004
  3. Bernd Oninger
    Replies:
    0
    Views:
    842
    Bernd Oninger
    Jun 9, 2004
  4. Joel Hedlund
    Replies:
    2
    Views:
    554
    Joel Hedlund
    Nov 11, 2006
  5. Joel Hedlund
    Replies:
    0
    Views:
    326
    Joel Hedlund
    Nov 11, 2006
Loading...

Share This Page