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,
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...