问题描述
任何人都可以帮助我吗?我想知道代码是如何工作的。
我尝试了什么:
char filename [MAX_PATH] =D:\\example\\test.txt;
FILE * fp;
fp = fopen_s (& fp,filename,r);
//想要检查给定路径是否正确,但没有异常。例如:filename [] =A:\\ file\\test.txt这是一条无效路径,如何知道?
Can any one help me? I want to know how really that code works.
What I have tried:
char filename[MAX_PATH] = "D:\\example\\test.txt";
FILE *fp;
fp = fopen_s(&fp, filename, "r");
// want to check the given path is correct or not with out exceptions. for eg: filename[] = "A:\\file\\test.txt" which is a invalid path, how to know that?
推荐答案
返回值
如果成功则为零;失败时的错误代码。有关这些错误代码的详细信息,请参阅errno,_doserrno,_sys_errlist和_sys_nerr。
Return Value
Zero if successful; an error code on failure. See errno, _doserrno, _sys_errlist, and _sys_nerr for more information about these error codes.
错误代码告诉您失败的原因: []
这篇关于我们怎样才能找到给定的“文件路径”。是否有效,使用C程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!