Unable to open a file with fopen()

后端 未结 8 994
盖世英雄少女心
盖世英雄少女心 2020-12-03 18:21

I\'ve been trying to open a file and output text, but I keep getting errors. So I thought I would start at the very beginning and just try opening the file. This is my cod

8条回答
  •  一个人的身影
    2020-12-03 18:43

    In addition to the above, you might be interested in displaying your current directory:

    int MAX_PATH_LENGTH = 80;
    char* path[MAX_PATH_LENGTH];
    getcwd(path, MAX_PATH_LENGTH);
    printf("Current Directory = %s", path);
    

    This should work without issue on a gcc/glibc platform. (I'm most familiar with that type of platform). There was a question posted here that talked about getcwd & Visual Studio if you're on a Windows type platform.

提交回复
热议问题