Here is an extract from K & R C programming Tutorials
A file is opened by a call to the library function fopen(): this is available automatically when the library file <stdio.h> is included. There are two stages to opening a file: firstly a file portal must be found so that a program can access information from a file at all. Secondly the file must be physically located on a disk or as a device or whatever. The fopen() function performs both of these services and, if, in fact, the file it attempts to open does not exist, that file is created anew. The syntax of the fopen() function is:
returnpointer = fopen("filename","mode");
So better keep in mind that if the file is not present a new one with the same name will be created.
thx for ur help but i am still in confusion .. i am using ofstream functon of ifstream header file ... its syntax is
ofstream buffer ("filename" , file mode)
but since file is placed in a folder in bin so where can i define pth for file as ofstream function can locate files only in BIN folder .
If u want the buffer ("fileName", "fileMode"); to work at a custom defined location, for eg. BIN in your case then you can try somthing like this: buffer ("c:/c compiler/BIN / file.txt", "w"); Hope it helped,