Hey folks!
When I try to open the filename for writing, the error message is:Code:char tempname[FILENAMELENGTH]; FILE *p_openfile1; tmpnam(tempname); printf("%s", tempname); if((p_openfile1 = fopen(tempname, "w")) == NULL) { perror("Error opening temp file"); exit(EXIT_FAILURE); }
I have no problems opening any other file, just the temp file generated by tmpnam().Code:\s2vc. Error opening temp file: Permission denied
I am assuming that fopen() tries to open the file in the "Windows" folder, which I don't have permission to do as a normal user. Does the fact that the temp filenames ends in a . have anything to do with the problem of opening it?
EDIT: Actually, is \ a part of the filename too? Could that be causing problems?
My textbook doesn't mention any such problem.
Thanks in advance.![]()



LinkBack URL
About LinkBacks




