Is there a file pointer (FILE*) that points to nothing?

前端 未结 6 732
醉酒成梦
醉酒成梦 2021-01-23 03:09

For some reasons I need a file pointer (FILE*) that points to nothing. It means I can pass it to fprintf function and fprintf ignore the file pointer.

for example:

6条回答
  •  情话喂你
    2021-01-23 03:37

    No.

    Your code will cause a run-time exception. You can use /dev/null for example, if you're running on an OS that supports it, but there's nothing like that built-in in C++.

提交回复
热议问题