file-io

FileNotFoundException + Writing a File to SD Card

I am trying to download a file from the net and write it to the SD card. I have the WRITE_EXTERNAL_STORAGE permission enabled. The code fails here: OutputStream output = new FileOutputStream(filePath); 09-15 19:40:31.630: WARN/System.err(7933): java.io.FileNotFoundException: /sdcard/artoo/Customerv08.apk 09-15 19:40:31.630: WARN/System...

Log File Locking Issue in C#

I have a windows service that writes out log file entries to an XML log file. I maintain a handle to the log file while the service is operational, and close, flush and dispose of it when the service is stopped. The file write operations are by the service only, and I have the filestream open in FileAccess.ReadWrite while sharing is set ...

Transforming lots of XMLs (File objects) into a single String with all the files' contents

What is the most effective (performance-wise) and clean way to perform the transformation of taking up to 500 XML files, sized up to 50 Mb each and making a single String out of them. All files are XML and need to keep the formatting etc. I'm currently doing the reading using XMLEventReader , and then XMLEventWriter,reading one event at...

How do I reference a resource in Java?

I need to read a file in my code. It physically resides here: C:\eclipseWorkspace\ProjectA\src\com\company\somePackage\MyFile.txt I've put it in a source package so that when I create a runnable jar file (Export->Runnable JAR file) it gets included in the jar. Originally I had it in the project root (and also tried a normal sub fold...

Best way to persist an XML file on iPhone?

I'm using MonoTouch and also System.Data to create a DataSet (just xml to those not familiar) for simple data binding. Data on my app is minimal so no need to go all out with SQLLite. The dataset use makes it easy to pass via web services for cloud sync. I serialize the DataSet to the personal folder on save and of course read this fi...

stumbled in using ZwOpenFile.

I have to open a file using ZwOpenFile API. This is my requirement. When I set the path in object name parameter. I could see fields Length and maximumlength in the object name. Length is just length of the path and I usually keep maximumlength as the value of Length. It worked mostly, however some times it doesnot work. In some cases ...

Removing String double-quotes in Haskell

This function generates simple .dot files for visualizing automata transition functions using Graphviz. It's primary purpose is debugging large sets of automatically generated transitions (e.g., the inflections of Latin verbs). prepGraph :: ( ... ) => NFA c b a -> [String] prepGraph nfa = "digraph finite_state_machine {" :...

inserting data in the middle of a text file through java

I want to insert the data at some positions in the text file without actually overwriting on the existing data.I tried RandomAccessFile ....but that also overwrites it.... Is there any way to insert the data without overwriting?? -Thanks in advance ...

Is there An Appllication For Testing Various File I/O In Windows?

I'm developing a network-redirector like SMB. I want to test various file I/O to compare NTFS or SMB implementation. What I want to test are, CreateFile Read, WriteFile DeleteFile RenameFile Set, GetFileInformationByHandle etc. And it' would be better if it can measure each I/Os duration. Is there a program I can use? ...

Reading the whole text file into a char array in C

Hi, I want to read the contents of a text file into a char array in C. Newlines must be kept. How do I accomplish this? I've found some C++ solutions on the web, but no C only solution. Thanks! Yvan Edit: I have the following code now: void *loadfile(char *file, int *size) { FILE *fp; long lSize; char *buffer; fp =...

Using a datetime as filename and parse the filename afterwards?

Hello, I am writing files to my harddrive,The filename is build like this: String.Format("{0:yyyy-MM-dd_hh-mm-ss}.txt", DateTime.Now) So the filename is "2010-09-20_09-47-04.txt" for example. Now I want to show those filenames in a dropdown, but with another format. The format should be dd.MM.yyyy HH:mm:ss. How can I do that, or is th...

oracle to flat file

I need to create a flat file and push information into it from oracle database using JSP. I require a sample code. Help will be appreciated. ...

How to dispose of resources in iTextSharp append method on exception

I have the following method using the iTextSharp library which should process and move the source document to a target document (which may or may not already exist). There is an append flag which will append the contents if the document already exists. I'm throwing an exception if append isn't set, but I'm having some problems working o...

How to load a file list in javascript?

How do I load a list of files from a specified folder in javascript? update Actually is from a Xul application, but I think anything for a local html file will work.. (it's a standalone app). And are resource files (images) I'm talking about.. ...

C# system.io.filenotfoundexception

I am creating an app for my work to track behavior management over the course of a school year. To do this, I obviously needed a database. I built the program so that it would, when opened, check to see if the database exists, and if it doesn't, it creates one, and inputs the schema. This works perfectly on my dev computer, but when I ...

How would I write some values/strings in particular columns of a file in python

I have some values that I want to write in a text file with the constraint that each value has to go to a particular column of each line. For example, lets say that I have values = [a, b, c, d] and I want to write them in a line so that a is going to be written in the 10th column of the line, b on the 25th, c on the 34th, and d on the 4...

What is the simplest way to write 4 arrays into a file in a multiplatform way?

Say we have a struct of an int array, a float array etc. and we need to write them into a binary format file for fast reloading. Can this be done in a simple way? Should the files be several for each of the array? ...

C++/Win32: How to wait for a pending delete to complete?

Please: There are no leaked handles [1]. The file is not open by anything in our software (it could be held open by an AntiVirus or a system indexing service, etc.) The code below can be compiled and run on your computer at home/office: you can see instantly that this loop fails and by itself NEVER attempts the Delete until after ALL h...

Simple question on file seeking in C.

Say I write in a file Mesh: 1 Vertices: 345 Indices: 123 V: 1,3,4 1,4,5 .. Mesh: 2 Vertices: 456 Indices: 42 etc. How do I go about seeking at any position? E.g. I want to go to Vertices: of Mesh 2 or V: of Mesh 3 etc. What's the proper way to go about these things? ...

Read/Write CSV as binary with Python

I just found out that I can save space\ speed up reads of CSV files. Using the answer of my previous question http://stackoverflow.com/questions/3710263/how-do-i-create-a-csv-file-from-database-in-python And 'wb' for opens w = csv.writer(open(Fn,'wb'),dialect='excel') How can I open all files in a directory and saves all files ...