file-io

Is there a simplistic library available (for multiple platforms) that makes it easy to write array data onto files?

e.g. one has a couple of arrays of ints or floats and a few integers to store. Is there a simplistic way to save them for later reloading without having to write a data format from scratch etc.? ...

Implementing use of 'with object() as f' in custom class in python

I have to open a file-like object in python (it's a serial connection through /dev/) and then close it. This is done several times in several methods of my class. How I WAS doing it was opening the file in the constructor, and then closing it in the destructor. I'm getting weird errors though and I think it has to do with the garbage col...

c# ASP.NET How do i delete a file that is "in use" by another process?

I'm loading a file: System.Drawing.Image img = System.Drawing.Image.FromFile(FilePath); Now I would like to save the image: img.Save(SavePath); This works.. Unless FilePath == SavePath, then it decides to give me the error: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. So I tried to delete t...

What is the fastest way of getting a file length in .net?

What is the fastest way of getting a file length in .net? Note: I am accessing files via a network share. So far I have 1.5ms FileInfo.Length .5ms FileStream().Length ...

Reload CoreData DB

Hello, In some part of my app I replace the db.sqlite file used by CoreData to store all my app data but the loaded data doesn't change. I noticed that the new data is only shown when I restart the app. Maybe someone can explain-me why this happens and how to solve it. Thank you very much, ...

Why does FileStream.Position increment in multiples of 1024?

I have a text file that I want to read line by line and record the position in the text file as I go. After reading any line of the file the program can exit, and I need to resume reading the file at the next line when it resumes. Here is some sample code: using (FileStream fileStream = new FileStream("Sample.txt", FileMode.Open, File...

How to read integers from a file that are 24bit and little endian using Python?

Is there an easy way to read these integers in? I'd prefer a built in method, but I assume it is possible to do with some bit operations. Cheers edit I thought of another way to do it that is different to the ways below and in my opinion is clearer. It pads with zeros at the other end, then shifts the result. No if required because shif...

c# change FileVersionInfo for any file

Hi experts. With FileVersionInfo class is very easy to read file extra information, but is there any way i can change it? Thanks. ...

problem while writing data into xml, when event occured

Hello, I'm trying to write a little software for logging data, if any type of file created in directory A. I use FileSystemWatcher class to get information about file creation in folder A. There are many subfolder in folder A. And many users can create file in this directory in one time. I use XML data to save log data. XmlTextReade...

c# continuously read file

Hi. I want to read file continuously like GNU tail with "-f" param. I need it to live-read log file. What is the right way to do it? ...

What's the most effective way to insert content into binary file, or join two files.

We want insert something into binary file, but want do I/O as less as possible. We don't want read the second part and write it back. Is there any way to do it. We know in theory, file are saved as blocks in file system. Could we just break the chain of blocks and insert a new one between it? The same idea could also be used in join two...

Extract parents from a File up to the "root" ("c:\" or "/")

Hello, I need to extract all available parents for a file. For example, i have a file like "c:\users\admin\Downloads\1\2\3\4\5\test.stub", i need to add any parent to a list of Files, that it contains: c:\users\admin\Downloads\1\2\3\4\5\ c:\users\admin\Downloads\1\2\3\4\ c:\users\admin\Downloads\1\2\3\ ... c:\ Any Ideas how i could m...

Using Insert Iterators when reading from file.

can you use Insert Iterators while reading from a file to put the data into STL container? for example: FILE *stream; fread(back_inserter(std::list), sizeof(int), 1, stream); ...

Query on File access in Java

Hello All, I am writing a code that collects all the credit card information of each buyer and storing it in a File. The format that I am using to store information in a file is: [Credit Card Number] | [User Name] | [Street Address] | [Zipcode] | @ [Credit Card Number] | [User Name] | [Street Address] | [Zipcode] | @ ..... Now, C...

deleting random access file in java

I've created a random access file as follows: RandomAccessFile aFile = null; aFile = new RandomAccessFile(NetSimView.filename, "rwd"); I want to delete the file "afile". can anyone suggest me how to do it? ...

Java File access - Performance considerations

All, Considering my earlier query Stackoverflow-Post, here is what I am currently doing. This is a kind of flowchart: 1 > Add record to file: a. Get the details for new record b. Retrieve all the records from the file. c. Compare each record retrieved with the new record details. If match found, do not add to the f...

Concurrent I/Os with same handle

Thread1 SetFileInformationByHandle(fileHandle, ...); Thread2 SetFileInformationByHandle(sameFileHandleWithThread1, ...); Thread1's function has been called first. and Thread2's function has been called in another thread. if the function's duration is 10 seconds -the device driver sleeps in the dispatch routine, will the se...

What changes are made in the mass storage API between Android 1.5 and Android 1.6

I wrote some code to save images on the SD Card a while back. Now I added the targetSDKVersion to my manifest and now my file saving code ceased to work. I can reproduce it through removing the targetSdkVersion from my manifest from that on my App won't write anything to the SD Card. Is there an API change between Android 1.5 and 1.6 ...

Most efficient way to create a large file (> 1GB)

Hi, I would like to know what is the most efficient way to create a very large dummy File in java. The filesize should be just above 1GB. It will be used to unit test a method which only accepts files <= 1GB. ...

Does File exist in Python?

Possible Duplicate: Pythonic way to check if a file exists? How can Check if file exist with python 2.6? If file exists run exec redo.py. If file does not exists exec file start.py The file is a 0kb, but name Xxx100926.csv Ans seems to be from os path import exists from __future__ import with_statement if exists('...