如何将文件句柄传递给Standard C中的函数 [英] How do you pass a file handle to a function in Standard C
本文介绍了如何将文件句柄传递给Standard C中的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以告诉我如何将活动的,打开的文件句柄传递给函数吗?我需要使用一个函数来fprintf .txt文件中的封面.
OP的更新:
Could someone please show me how to pass an active, open file handle to a function? I need to use a function to fprintf a coverpage in a .txt file.
UPDATE from OP:
Is this right?
void printHeading(FILE *outHandle);
void printCoverPage(FILE *outHandle);
int main()
{
FILE *inFile;
FILE *outFile;
printCoverPage(outFile);
printHeading(outFile);
}
void printHeading(FILE *outHandle)
{
outHandle = fopen(fileName, "w");
}
void printCoverPage(FILE *outHandle)
{
outHandle = fopen(fileName, "w");
}
推荐答案
规则一:研究.
快速搜索该站点即可显示给同学的几个答案.看他们.他们给出了答案.
这说明了这一点:应答者和您一样对这个站点来说是新的...
将文件句柄作为参数传递给功能? [ ^ ]
Rule one: Research.
A very quick search of just this site shows several of the answers give to your classmates. Look at them. They give the answer.
This one spells it out: And the answerer is as new to this site as you are...
Passing a File Handle as a parameter to a function?[^]
这篇关于如何将文件句柄传递给Standard C中的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文