file-io

android - how to get file stream? (download manager)

Hi, Im doing a project which similiar like download manager. I have 1 of the function is it allow user to pause the file and they can resume the download later.I have google it, but unlucky i stil haven solve the problem (maybe i'm new in android and stupid to solve it). the question is.. if one of the file was haven finish downloaded f...

Delphi notification when a file gets updated

Hi All, My app contains documents in its database. The users can open the documents in which case, the document gets saved to a temporary folder and gets opened on the user's computer. I'd like to get a notification when one of these temporary files are changed, and offer the user to save the changed document back to the database. Wha...

Getting rid of file-based communication

I have to work with two C programs that communicate via a file-based interface. That is, each of them has a main loop where it polls three or four files (fopen, fscanf), reacts to what it reads and eventually makes its own changes to the files (fprintf) for the other process to read. Now I have to condense these two programs into a sing...

Is it possible to do an unstoppable delete in C# ? (Compact Framework)

Given a folder i want to make sure that ALL the files on that directory are deleted. I know there maybe IOExceptions or Access Denied errors but how do just leave them aside and continue with my deletion of the files that I actually can delete? Is this possible? Please shed some light on me on where I can begin ...

Creating temporary files in Android

What's the best way to create a temporary file in Android? Can [File.createTempFile][1] be used? The documentation is very vague about it. [1]: http://developer.android.com/reference/java/io/File.html#createTempFile(java.lang.String, java.lang.String) ...

creating hidden files using .NET

How can I create or mark a file as hidden using .NET? ...

Serialise and deserialise vector in binary

Hi all, I am having problems trying to serialise a vector (std::vector) into a binary format and then correctly deserialise it and be able to read the data. This is my first time using a binary format (I was using ASCII but that has become too hard to use now) so I am starting simple with just a vector of ints. Whenever I read the dat...

How to deal with NaN's when reading in a csv file in C++

Hi, I'm reading in a csv file of time-series data into a C++ program. My data however contains some NaN's. For example: 1-Jul-2010, 1.0 2-Jul-2010, 2.0 3-Jul-2010, NaN 4-Jul-2010, 3.0 To deal with this I wrote a short script in Matlab which replaces all the NaN's with 0.0 - I then read in the new file without the NaN's. I...

How to convert a Hadoop Path object into a Java File object

Hi Is there a way to change a valid and existing Hadoop Path object into a useful Java File object. Is there a nice way of doing this or do I need to bludgeon to code into submission? The more obvious approaches don't work, and it seems like it would be a common bit of code void func(Path p) { if (p.isAbsolute()) { File f = new ...

How to do file I/O with a servlet running on Tomcat

I am writing a Java servlet, using Tomcat as the container, which creates and serves PDF files to the end-user. Currently the PDF files are created in-memory and written out as a response to a POST. I would like to change this up somewhat so that the PDF files are written to disk (so they can be served up again later). I am having troub...

Easy question: Read file, reverse it and write to another file in Ruby

I have: o = File.new("ouput.txt", "rw+") File.new("my_file.txt").lines.reverse_each { |line| ????? line } o.close I don't know what method to use to write to the file output o ...

Is there a more efficient way to generate a random file in Perl?

This is my first Perl script. Ever: #!/usr/bin/perl if ($#ARGV < 1) { die("usage: <size_in_bytes> <file_name>\n"); } open(FILE,">" . $ARGV[0]) or die "Can't open file for writing\n"; # you can control the range of characters here my $minimum = 32; my $range = 96; for ($i=0; $i< $ARGV[1]; $i++) { print FILE chr(int(rand($range)...

I want tor read some double data from text file in C#

my double data in text file like below: 1.4 2.3 3.4 2.2 2.5 2.5 I want simply read this data from file and store it in an array. please help me. I'm a beginner in C# ...

How can I read a text file without locking it?

Hi, I've a windows service writes its log in a text file in a simple format, Now, I'm going to create a small software to read the service's log and show the existing log and the added as live view, the problem is when the service will lock the text file while adding the new lines, and the viewer application will lock the file while re...

Getting error when trying to apply "ExtraSamples" tag to a TIFF file to be written

I have a program that takes an image and writes that out to a TIFF file. The image can be grey scale (8 bit), grey scale with alpha channel (16 bit), RGB (24 bit), or ARGB (32 bit). I don't have any problems writing out the images without an alpha channel, but for the images with alpha, when I try to set the extra samples tag, I get se...

Unit Testing File I/O Methods

I am still relatively new to unit testing. I have written a class in Ruby that takes a file, searches through that file for a given Regex pattern, replaces it, then saves the changes back to the file. I want to be able to write unit tests for this method, but I don't know how I would go about doing that. Can somebody tell me how we unit ...

non-blocking file openat()

I would like to implement a multi-threaded, non-blocking file open. Ideally, the desired solution would be to make a call to open() & have it return immediately, and do something like register a callback to be called (or handle a signal, or conditional variable) when the open() operation is actually complete. To that end, I wrote a lit...

Reading certain lines from text files

I want to read in the 1st, 4th, 7th, etc. (every 3 lines) from a text file but am not sure how to go about doing so as nextLine() reads everything sequentially. Thank you for your suggestions? Scanner in2 = new Scanner(new File("url.txt")); while (in2.hasNextLine()) { // Need some condition here String filesURL = in2.nextLine()...

Opening and Analyzing ASCII files

How do I open and read an ASCII file? I'm working on opening and retrieving contents of the file and analying it with graphs. ...

Does having a directory structure slow down file retrieval on a windows file system?

Say i have thousands of files. Is it better to have one folder to store the files or is it better to have sub folders? What is better for c# program to locate a retrieve files (from a performance pov)? Thanks ...