gpt4 book ai didi

Visual Studio 2010 中的 c stdio 文件

转载 作者:行者123 更新时间:2023-11-30 15:15:28 25 4
gpt4 key购买 nike

我正在学习 C,并且我正在尝试遵循我可以在网络上找到的许多示例

当我访问某些 stdio 关键字和 typedef 时遇到问题或类型。

例如

#include <stdio.h>

int main()
{
File *f; ---->error : identifier "f" is undefined
//or found via codeblocs intellisense i also tried filebuf

filebuf *f; ---->error : identifier "filebuf" is undefined
// though this would compile
getc('');
}

因为它无法找到File结构

最佳答案

File 应更改为 FILE。此外,getc 函数采用 FILE 指针而不是 '',并且 filebuf 应更改为 _iobuf

#include <stdio.h>

int main()
{
FILE *f;

//_iobuf *f;

f = fopen("somefile","r");

getc(f);
}

关于Visual Studio 2010 中的 c stdio 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33611430/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com