Hey guys I'm currently writting a basic encryption program which works flawless on all types of files.
Unfortunately when I attempt to run it on a folder instead of individual files my fopen function always returns NULL.
Is there some sort of hidden file extension for Windows folders that I need to include with the folder name, or maybe some other way I should go about this?
Here is my basic open file code that works fine on all file types except folders:Code:#include <stdio.h> #include <stdlib.h> int main() { int count, key, random, flag; char end; char ORGfile[10] = "ORGfolder"; //original folder name char ENCfile[10] = "ENCfolder"; //encrypted folder name FILE *in, *out; printf("\nEnter encryption key: "); scanf("%s", &str); key = atoi(str); srand(key); if (( in = fopen(ORGfile, "rb")) == NULL) { printf("\n\t\..........* ERROR: unable to open file for reading ***\n"); return(-1); } else { //the rest has been omitted since it has nothing to do with this question... } return(0); }



LinkBack URL
About LinkBacks


