file-io

Evernote export format (ENEX) to HTML, including pictures?

@Solved The two subquestions I have created have been solved (yay for splitting this one up!), so this one is solved. I'll award the check mark to samjudson, since his answer was the closest. For actual working solutions though, see the below subquestions; both my implemented solutions and the checked answers. @Deprecated I am splitti...

Detecting metadata-only read requests in windows filesystem

Hello, I'm developing a kind of filesystem driver. All of read requests that windows makes to my filesystem goes by the driver implementation. I would like to distinguish between "normal" read requests and those who want to get only the metadata from the file. ( Windows reads first 4K of the file and then stop reading ). Does Windows ...

Recently, i am on a project which needs raw read / write sector of drives

Before, I post a question here asking for advice on how to read and write data from and into drive, not via file label like "aaa.txt", but just sectors.. I was advised to try read and write.... but new problems'v raised... the hairy parameters int _read( int handle, void *buffer, unsigned int count ); when i use the function and wanto ...

In Cocoa, do you have to do anything special to make sure you copy resource forks when copying files?

I had assume I could just do this, but I don't have a way to check that resource forks went along for the ride. NSFileManager *fm = [NSFileManager defaultManager]; [fm copyPath:absSourcePath toPath:absDestinationPath handler:err]; edit: I need to copy in a 10.4-6 compatible manner. (Yes, really 10.4.) ...

Fortran: How do I read the first character from each line of a text file?

Hi, this is my first time trying to program in Fortran. I'm trying to write a program that prints the first 1476 terms of the Fibonacci sequence, then examines the first digit of each term and stores the number of 1s, 2s, 3s, ..., 9s that occur in an array. The problem that I can't seem to figure out is how to read the first digit of ea...

crash while calling CMemFile::Detach()

Hi I am observing a crash while calling the CMemFile::Detach() function The exception with the call stack is as below kernel32!RaiseException+53 e06d7363 00000001 00000003 msvcrt!_CxxThrowException+36 0103bb7c 7f0f6eac 00d8bf68 mfc42u!AfxThrowFileException+61 00000009 ffffffff 00000000 mfc42u!CMemF...

Why aren't all the entries going in the file?

In the following program, loop is iterating 1000 times, and I am writing all the entries in a file using a FileWriter, but unfortunately programs ends up writing only 510(sometimes 415, sometimes 692, always less then 1000) entries in the file, but loop is iterating 1000 times. import java.io.* ; import java.util.*; public class DemoWr...

Select Random Datas From File

Hello, I'm learning C# and now I need to build a home project(just to learn how to use file I/O and random). I have a file(names.txt) like this: Nathan John Max Someone But how I can access this file(already know) and select a random name, print it and delete this name from the file? Thanks. ...

Physical File Path

What is the best way to get the physical path to a file in C#? UPDATE: I have a file name but I don't want to hard code the path to it since it may change. I just know its relative path but not its physical path. ...

Reading from files in python

I need to find out the maximum and minimum value in a line by reading a file and should be dividing the maximum value by the minimum value. Am interested to do this in python. the contents of the file (file.txt) looks like this.. A28102_at,151,263,88,484,118,270,458,872,62,194 AB000114_at,72,21,20,61,20,85,20,25,20,65 AB000115_at,281,...

Reading an std::ifstream to a vector of lines

How would I go about reading in a file where each line is a single number, then outputing that number into a vector of lines? eg: file.txt contains: 314 159 265 123 456 I have tried this implementation: vector<int> ifstream_lines(ifstream& fs) { vector<int> out; int temp; getline(fs,temp); while (!fs.eof()) { ...

C++ const void* conversion

I'm trying to pass three parameters to my write() function: write(fd, "C,1,1\r\n", 7); This works fine. But I would like to take a parameter and pass it to the command portion to make it dynamic: write(fd, N, 4); I'm not familiar with c++ types, but it keeps asking for a type of "const void*" I've been able to convert my variable, ...

PHP fwrite vs. output piping

I'm writing a tool that allows someone to connect to a web page and generate files for download on the fly. To write these files, I can use PHP functions like fopen or fwrite, or I could create a script that can be called as a system call to generate the output such as: php downloadGen.php > filetocreate.xml The fwrite version of the ...

Cannot create a file when that file already exists.?

hi this is Ramesh i have winforms, i trying to copy the file one location to another,if same file name is there i need to overwrite, but i got error like "Cannot create a file when that file already exists." but my query is i want to overwite what should i do? but i'm trying File.copy and File.move method not in use same error come ...

How to cache reading from a file .NET 2.0

I have an httpmodule that reads from a csv file for redirection rules. However, since it's an httpmodule and it is checking on every request, I obviously don't want to read the file every time. What are some strategies to cache the rules (in an in Array) so that I do not have to read the file on every request? Update: Using .NET 2.0 ...

XSLT: Convert base64 data into image files

I have seen several questions on how to encode an image file in base64, but how about the other way around - how do I reconstitute a picture from a base64 string stored in an XML file? <resource> <data encoding="base64"> R0lGODlhEAAQAPMAMcDAwP/crv/erbigfVdLOyslHQAAAAECAwECAwECAwECAwECAwECAwECAwEC AwECAyH/C01TT0ZGSUNFOS4wGAAAAAxtc09QTVNP...

How do I create a string using a loop variable in MATLAB?

I have a loop like this: for i=1:no %some calculations fid = fopen('c:\\out.txt','wt'); %write something to the file fclose(fid); end I want data to be written to different files like this: for i=1, data is written to out1.txt for i=2, data is written to out2.txt for i=3, data is written to out3.txt etc. Doing 'out'+ i ...

Is there a Java utility which will convert a String path to use the correct File separator char?

I have developed a number of classes which manipulate files in Java. I am working on a Linux box, and have been blissfully typing new File("path/to/some/file");. When it came time to commit I realised some of the other developers on the project are using Windows. I would now like to call a method which can take in a String of the form "/...

Error creating an XmlWriter when file already exists.

In my code, I have these lines: XmlWriterSettings writerSettings = new XmlWriterSettings(); writerSettings.Indent = true; XmlWriter writer = XmlWriter.Create(filename, writerSettings); document.Save(writer); This works fine when filename does not exist. But when it does, I get this error (on the 3rd line, not the 4th): System.IO.IOEx...

Using PHP to print out a downloadable text file

My script puts together a set of htaccess rules based on information passed into it and gives the user a downloadable text file with the rules printed out inside. The idea is that an administrator fills out some form information, clicks a downloadable link, gets a text file with the rules printed out inside, opens the file, copies the r...