Its been awhile im trying to refresh myself as i just started a c++ class and already i have a problem.
i have the prefix.dat in the same directory but it still says cannot open and also the function "FILE* open(const char filename[])" we are supposed to use and i was wondering can i use file* open to open the file or is that just a function like "int calculate(int number);"Code:#include <stdio.h> FILE* open(const char filename[]); int main() { const char filename[11] = "prefix.dat"; open(filename); } FILE* open(const char filename[]) { FILE* fp; printf(filename); fp = fopen(filename, "r"); if (fp == NULL) { printf(" cannot open"); } if (fp != NULL) { printf(" opened"); } fclose(fp); }



LinkBack URL
About LinkBacks



