Hi, I am creating/opening a file using, FILE *file = fopen(" C:\\ABC\\Poo.txt","w+"); if(file == NULL) printf("un sucessful"); else printf("sucessful"); I am able to create a file name poo.txt on C:\ABC folder. Now I used, #define PATH "C:\\ABC\\" FILE *file = fopen(" PATH+Poo.txt","w+"); OR #define PATH "C:\\ABC" FILE *file = fopen(" PATH\\Poo.txt","w+"); if(file == NULL) ........ How can I use PATH constant with file name in fopen? Help me out ASAP. Thanks in advance.
I tried this in linux machine.We can do this . You have to mention like the following , Code: FILE *file=fopen(PATH"/file.txt","r+"); Don't place the PATH inside the double quotes , because what ever inside the double quotes will treated as a string.