Assign file to stdout problem

Discussion in 'C Programming' started by Edward Rutherford, Oct 16, 2011.

  1. Hello

    I'm trying to port some C source code from Solaris to Linux and I have a
    problem. There is a declaration:

    static FILE * outfp = stdout;

    and GCC gives the error:

    initializer element is not constant

    What's the best workaround for this?

    //EPR
    Edward Rutherford, Oct 16, 2011
    #1
    1. Advertising

  2. Edward Rutherford

    Paul N Guest

    On Oct 16, 8:18 pm, Edward Rutherford
    <> wrote:
    > Hello
    >
    > I'm trying to port some C source code from Solaris to Linux and I have a
    > problem. There is a declaration:
    >
    > static FILE * outfp = stdout;
    >
    > and GCC gives the error:
    >
    > initializer element is not constant
    >
    > What's the best workaround for this?


    Assign it to stdout at the beginning of main?
    Paul N, Oct 16, 2011
    #2
    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. Elad
    Replies:
    0
    Views:
    403
  2. Replies:
    1
    Views:
    273
  3. Jason

    Assign file to stdout problem

    Jason, Dec 4, 2010, in forum: C Programming
    Replies:
    11
    Views:
    818
    Seebs
    Jan 4, 2011
  4. Andreas S
    Replies:
    3
    Views:
    246
    Eric Hodel
    Dec 9, 2006
  5. Replies:
    2
    Views:
    320
    A. Sinan Unur
    Dec 7, 2005
Loading...

Share This Page