Questions tagged [fclose]

fclose closes an open file resource, releasing it from memory and any write-locks on the file.

fclose closes an open file resource, releasing it from memory and any write-locks on the file.

It is a matching function for fopen, after read and writes have been completed. This function will release any write-locks on the file. While often unimportant for batch processes (when a process ends, write-locks are automatically released), it becomes important to release unused resources for long-running applications or background processes.

278 questions
-3
votes
1 answer

C (BEGINNER ) - Writing a 2D array into a file

Hello i would like to store a matrix into a file here's the code I made void fichier_print(grid_t grille, int n){ int i,j; FILE *f_solution; f_solution=fopen("solution.txt","wb"); if( f_solution == NULL ) { printf("Le fichier est…
-3
votes
1 answer

Must I using fclose function?

When I open file : $d = fgets(fopen("file.txt", "r")); and I don't created file pointer, need I using fclose() ?
-3
votes
3 answers

Function fscanf crash app after first use

If I comment fprintf(pf,"1111"); the exe will crash and if I keep it,I get 2/3/2011 (only the first record).If I try to close the file the exe will crash too. Is fscanf detecting the end of row as end of file and reads null? I tried also…
King Tsunamy
  • 47
  • 1
  • 7
-3
votes
1 answer

Using fwrite in PHP but outputs odd error

I am currently using fwrite, and this is what outputs as an error: Parse error: syntax error, unexpected ')' in /home/blah/blahblah.com/write/submit.php on line 5 The code goes like this: $strlen = strlen ( $_REQUEST["content"] ); $content =…
jeffw
  • 1
  • 3
-4
votes
1 answer

how solve mkdir and fopen file in php?

When I want to do folder for the member who registered into my site Inside this folder is a folder for photos and the main file of the member. this is problem :- The first folder is done with the member name successfully but the photo folder and the…
-4
votes
1 answer

fopen PHP error (expects parameter 1 to be resource)

I am trying to create a directory with a PHP file in it (that part works). Now I am trying to open that PHP file and put in data, but I get error: Warning: fwrite() expects parameter 1 to be resource, string given in C:\wamp\www\dev 3\1\index2.php…
Dermot
  • 17
  • 6
-4
votes
3 answers

One-liner for fopen, fprintf, fclose?

I'm putting some very temporary debug prints into various userspace programs to figure out what code runs on an embedded Linux device, and I want these prints to write to a file without leaving it open. To make the debug more portable between the…
vestlen
  • 1,103
  • 11
  • 17
-6
votes
1 answer

How to debug why my C code causes a segmentation fault?

The code below takes a window of size windowSize and shift the window by some shiftSize samples in each iteration. I did the unusual "printf()" debugging and got that the code is giving error at segmentation fault. Can somebody tell me what the…
Developer by Blood
  • 155
  • 1
  • 3
  • 11
1 2 3
18
19