I'm developing an application that is reading and writing a lot (but synchronously, though) to a certain file on disk. However, how larger the file gets, the more often I get the following IOException:
The requested operation cannot be
performed on a file with a user-mapped
section open.
occuring from:
at System.IO.__Error.Win...
I have an winforms application that loads in excel files for analysis. Currently, in order to open the excel file the file must not be already open in excel otherwise a FileIOException is thrown when I try and load in the file.
What I would like to do is allow my application to read in the file even if it is open in excel rather than fo...
I know, that there's the is_open() function in C++, but I want one program to check if a file hasn't been opened by another application - is there any way to do it using standard library?
EDIT - Clarified in the answers that this is for a Linux application.
...
I was trying to do some scripting in Scala, to process some log files:
scala> import io.Source
import io.Source
scala> import java.io.File
import java.io.File
scala> val f = new File(".")
f: java.io.File = .
scala> for (l <- f.listFiles) {
| val src = Source.fromFile(l).getLines
| println( (0 /: src) { (i, line) => i + 1 } )
|...
How can I load a *.csv file which includes text and numerical data in LOGO?
e.g. N 43.876 W
...
In java i would read the whole file in to byte array and do some processing with it. Now i want to implement the same algorithm in clojure.
What i am wondering is can i use a list instead of an array?
I know i can create array from clojure but what is the lisp way of handling this?
...
I am a beginner Java programmer. I am attempting to make a simple text editor. I have got the text from the text field into a variable that's a String, called "text".
My question is, how can I save the contents of the "text" variable to a text file?
Thank you!
...
Working on an irc client in Adobe AIR in JavaScript, and thinking about logging. Each channel would have its own log file. I wouldn't keep all of the logs open while the app was running would I? I'd log every few minutes? What's the best way to do this?
...
Here's my method
[AcceptVerbs(HttpVerbs.Post)]
public void SaveImage(FormCollection formValues)
{
byte[] contents = Convert.FromBase64String(Request.Form["file"]);
System.IO.File.WriteAllBytes(Server.MapPath(Request.Form["name"]), contents);
}
It is getting posted to from this actionscript method:
...
I am working on a utility.
I want to append data at the top of the file, but it is overwritting not appending.
For eg : Consider the file.txt :
Something existing here
Now I want to append "Something more existing here" before the current line. Is there a way I can do without using 2 FileStreams ?
...
So I have a static class that is supposed to be used as a log file manager, capable of adding "messages" (strings) to a Queue object, and that will push messages out to a file. Trouble is, many different threads should be enqueueing, and that the writer needs to be async as well. Currently when I insert into the queue, I'm also checkin...
I need to find the cluster size of the users hard drive, through C or C++. The hard drive uses NTFS (though I'd appreciate knowing how it's done on other file systems as well).
I guess what I need is some combination of win32 API calls, but I don't know which.
For instance, typing "fsutil fsinfo ntfsinfo c:" in the windows console give...
I need to transfer files to my web server for processing and I'd like to do it in a generic way if possible.
I need to be able to transfer files from the following protocols at a minimum (with more to follow eventually):
HTTP
FTP
SCP
I'd really like to be able to send files to SMTP also
So my question, is there a toolkit available ...
I have two HANDLEs and they are created from the same file,
in such condition I want to write on offset from 1 to 100 using the first HANDLE,
and from 101 to 200 using the 2nd HANDLE, from 201 to 300 using the first HANDLE,
...,
How can I make this operation seems like a sequential write and no time is wasted
between positioning t...
Hello Folks,
I have a file in .gz format. The java class for reading this file is GZIPInputStream.
However, this class doesn't extend the BufferedReader class of java. As a result, I am not able to read the file line by line. I need something like this
reader = new MyGZInputStream( some constructor of GZInputStream)
reader.readLine...
I am stuck and in need of a hand. Hope someone can help?
Anyone have any idea why I am getting "failed write" in this code?
$write_file = "/usr/home/public_html/php/users_v2.sql";
$write_handle = fopen($write_file, "w") || die("Couln't open users_v2!");
if (is_writeable($write_file)) {
if ($write_handle === FALSE) echo 'Failed ha...
I'm attempting to solve the project euler problem number 8 with C++, and the problem is to find the greatest product of 5 consecutive numbers in a 1000 digit number. So I'm trying to figure out how to use file io to read the numbers into a char array that I will later convert to integers. The read works except for the last third of the l...
How can I tell if a file is open in C? I think the more technical question would be how can I retrieve the number of references to a existing file and determine with that info if it is safe to open.
The idea I am implementing is a file queue. You dump some files, my code processes the files. I don't want to start processing until the pr...
I got a raw YUV file format all I know at this point is that the clip has a resolution of 176x144.
the Y pla is 176x144=25344 bytes, and the UV plan is half of that. Now, I did some readings about YUV, and there are different formats corresponding to different ways how the Y & US planes are stored.
Now, how can perform some sort of ch...
The following code gives me a System.IO.IOException with the message 'The process cannot access the file'.
private void UnPackLegacyStats()
{
DirectoryInfo oDirectory;
XmlDocument oStatsXml;
//Get the directory
oDirectory = new DirectoryInfo(msLegacyStatZipsPath);
//Check if the directory exists
if (oDirectory.Exists)
{
...