Forward declare FILE *

前端 未结 6 1792
既然无缘
既然无缘 2020-12-09 17:14

How do I forward declare FILE * in C? I normally do this using struct MyType;, but naturally this doesn\'t appear to be possible.

If behavi

6条回答
  •  隐瞒了意图╮
    2020-12-09 17:47

    You can't. The standard just states that FILE is "an object type capable of recording all the information needed to control a stream"; it's up to the implementation whether this is a typedef of a struct (whose name you don't know anyway), or something else.

    The only portable way to declare FILE is with #include (or in C++).

提交回复
热议问题