ctime takes time_t as argument, not time_t*.Code:#include <iostream> #include <time.h> #include <stdio.h> using namespace std; int main() { FILE *t; char PATH[256]; strcpy(PATH, "c:/"); strcat(PATH, ctime(time())); strcat(PATH, ".txt"); t=fopen(PATH,"r"); // this could cause problems: "rt" would be preferred fclose(t); // change here return 0; }
probably logical error: you're opening a file for reading that will most likely not exist.




CornedBee
Reply With Quote