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
0
votes
2 answers

ofstream/fstream simply will not work, no matter what solution is tried

Okay guys, I've tried everything I can think of. I'm passing in a file name into this function. A little context: hash_table is an already initialized and filled vector with key pairs, and the 'value' part of the pair is a Linked List that has the…
user3145575
0
votes
1 answer

Android fix close main activity with back button

I'm trying to work at a simple book listing application. The app problem is that: if i move from Main Activity to 'New Book Activity', then I click on 'save' button, it comes back to Main. But if I press 'back' hardware button from here, it comes…
d33pcode
  • 27
  • 7
0
votes
1 answer

Linux fopen and fclose

Assume that I have fopen'ed a file with "rx" flag. Q1. What's the difference using "r" and "rx"? Q2. Is it possible that fclose could fail even if I fopen'ed a file with "rx" flag? I've heard that most of the reason for fclose's failure is due to…
daehee
  • 5,047
  • 7
  • 44
  • 70
0
votes
0 answers

After closing the file, I do not have access to it

I use this code in a multithreaded program: class A{ public: FILE *File; bool ThFunc(){ if (CreateDataFile()) std::cout << "File was created\n"; else{ std::cout << "Can't create file\n"; …
n1k
  • 5
  • 1
0
votes
1 answer

Text file contents will echo but not return php

I've been working o this for the last few weeks and can't find an alternate route. What I need to do is return the contents of a text file after the file has been read. I have two different logs that use text files to log errors. The first log…
0
votes
3 answers

fwrite(): supplied argument is not a valid stream resource

I keep getting 3 errors when I use this code: Warning: fopen() [function.fopen]: Filename cannot be empty Warning: fwrite(): supplied argument is not a valid stream resource Warning: fclose(): supplied argument is not a valid stream resource I…
nulldev
  • 97
  • 1
  • 3
  • 10
0
votes
2 answers

Can't write over files

I am trying to code a file shredder in PHP, and I get these errors: Warning: fopen(calculate): failed to open stream: Permission denied in C:\XAMPP\htdocs\shred.php on line 9 Warning: fwrite() expects parameter 1 to be resource, string given in…
0
votes
1 answer

Google text to speech API not working on php

//=======Text to Speech================== function tts($sentence) { $fragment = array(); $tmp = explode(" ",$sentence); $tmp_ = ""; $last_word = ""; foreach ($tmp as $value) { $tmp_.= "$value "; …
telexper
  • 2,381
  • 8
  • 37
  • 66
0
votes
0 answers

PHP fopen/fclose or ajax - not finding file

I'm having issues with my module. There are different steps involved and I'm not sure where it is hanging up at. I'm using an xml file for storage of data. When I add information via my php call, everything works fine. It is if I need to edit…
0
votes
2 answers

fclose, fopen and fwrite issues with writing multiple files

I have a program that records data from a serial port. Every so often, I want to split up files such that the data logs don't become very large. The problem is, after I recreate the FILE* and try to write into it, the program crashes. No compiler…
user2619824
  • 478
  • 1
  • 5
  • 20
0
votes
3 answers

Copy img from url to server: no such file or directory

I am using php to get an image from url and copy it to my server but got an error saying there is no such file Image example: http://www.google.co.in/intl/en_com/images/srpr/logo1w.png Here is the solution I am using: //Get the file $content =…
James Zhao
  • 671
  • 1
  • 8
  • 17
0
votes
1 answer

Save remote file on FTP

I am trying to download a file from a remote website using cronjob and save it on my hosting. For this purpose I am using the following function but unable to achieve the desired results. When i run the function no file is downloaded. function…
Saad Bashir
  • 4,341
  • 8
  • 30
  • 60
0
votes
1 answer

change from print to write file c

I have a code that reads an input from xdr file and shows the result on shell but I prefer that the program saves the results in a format I can read with geany or nano or others programs. The program: #include #include #include…
0
votes
3 answers

Write PHP files through a PHP file from records in a mySQL database

The previous solutions working with MS Access did not pan out so I am trying this time with php. I have this php file that opens a database, reads a list of records and creates an html file for each record, in their respective folder name (folder…
Luis
  • 15
  • 1
  • 6
0
votes
1 answer

Set limits for add content in text file with PHP

I need to create a list of last logged members in my website, but i don't wanna user MySQL. i did some search in stackoverflow and Google and wrote this code: ////////////CHECK LIMIT $storage = "engine/data/write.txt"; $readz =…
Alireza
  • 1,048
  • 5
  • 18
  • 36