file-io

Reading a File on OS X via Java - Is my path correct?

I am trying to do this File file = new File("/Users/Jon/Downloads/mynewalbum/artist - title.mp3"); I don't think its correct though as the properties returned don't seem correct. Maybe I have got a backslash or something wrong? ...

Text file to string array in plain c?

I want to load a txt file into an array like file() does in php. I want to be able to access different lines like array[N] (which should contain the entire line N from the file), then I would need to remove each array element after using it to the array will decrease size until reaching 0 and the program will finish. I know how to read t...

Can I assign the same file pointer a second file?

function() { FILE *ptr; ptr = fileopen(file1.txt) fprint(ptr, some text) //print to file 1 if(second file needed) { ptr = fileopen(file2.txt) //open a second file, assign to same file pointer fprint(ptr, some text) //print to file 2 not working here? } } EDIT: Not printing to second file...However...

Two processes reading/writing to the same file Python

I have one process who's reading from a file (using file.read()) and one process who's writing to the same file (file.write()). The problem is it doesn't work - I get no errors but they can't operate at the same time. I've tried making the read and write operations none-blocking and then flushing the stream, as follows: fcntl.fcntl(file...

How to get a MemoryStream from a Stream in .NET?

I have the following constructor method which opens a MemoryStream from a file path: MemoryStream _ms; public MyClass(string filePath) { byte[] docBytes = File.ReadAllBytes(filePath); _ms = new MemoryStream(); _ms.Write(docBytes, 0, docBytes.Length); } I need to change this to accept a Stream instead of a file path. Whats...

subscripting a specific line from python's csv reader?

i'd like to be able to access specific lines of a csv file through the csv reader. For example, the fourth line. Is there a way to do this with python's csv reader module? ...

Efficient bulk data transfer through I/O in Java

Is there an efficient mechanism in Java for transferring large amounts of data (~10 GB) back and forth between the disk and the network on a low-end machine? Low-end machine meaning a machine with much less than 10 GB of main memory. I want to efficiently transfer ~10GB portions of a file from one machine to another. ...

Fastest way to do many small, blind writes on a huge file (in C++)?

I have some very large (>4 GB) files containing (millions of) fixed-length binary records. I want to (efficiently) join them to records in other files by writing pointers (i.e. 64-bit record numbers) into those records at specific offsets. To elaborate, I have a pair of lists of (key, record number) tuples sorted by key for each join I ...

How can I ensure that multiple file IO opperations are successful?

I'm writing an application that catalog files and saves meta data with them through sidecar files. I'm trying to add file IO operations so the user can manipulate (copy, rename, move, delete etc..) through my application which will in turn manipulate the sidecar files as well. However, I'm worried that in some cases the one IO operation...

Find a replacement for Windows' PathAppend on GNU/Linux

C programming, are there any good ways to manage path strings rather than using C string API like strcat on linux? The equivalent of Windows' PathAppend would be great. Thank you! ...

Parse a particular number of lines

I'm trying to read through a file, find a certain pattern and then grabbing a set number of lines of text after the line that contains that pattern. Not really sure how to approach this. ...

C# File Encryption and Decryption issue

Been playing around with encryption and decrypting files in VC# Express 2010. All the tutorials and documentation I've seen requires two FileSteams in order to encrypt the file. One for reading the unencrypted version, and the other for encrypting. When I actually wrote the code it kept throwing an error telling me it could not open the...

File will not decrypt properly

Ok so at this point I've figured out many of the other issues I was having. Now upon attempting to decrypt the file, I receive no exceptions, however the data is not decrypted properly....it goes through the entire operation without throwing an exception, until I attempt to access the XML document via the combo box again after decrypting...

Listing Files Using PHP

I'm needing to make a web site, that should list all the files that are in the directory /Files(where / is the Apache public - htdocs), but excluding if there is any sub-directory. Also, they should have links for every file. Like this: echo "<a href='Link to the file'>Test.doc</a>" . "\n" How could I do it? ...

How to save a SQL Server image data type to the file system?

I'm having issues with the way I've been reading my image datatype blobs from my SQL database (code below). This code works fine when I access this page directly. The PDF will open and works just fine. However, when I try to use this page to download a file and save it to the file-system programmatically, it fails (500 server error) a...

File time stamp does not change with data update

I have customer which claims that he has one application which updates the data in log file but that application does not change the time stamp of the log file. I have question why would any application has such behavior. ...

Retrieving the underlying error when File.listFiles return null.

According to the File.listFiles javadoc the method Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs. I know that I am using a directory, but have received a null result, so an I/O error must've appeared. I'm very much interested in what the error was. How can I retrieve the error messa...

Writing an array to a (server-side) text file.

Hey, So I've got my javascript array (var seatsArray = [];), let's say it has some contents. I want to write the contents of that array to a .txt file on the server when the user clicks a button. The text file will not already exist so it needs to be created. Also, if anyone knows how I could allow the user to specify the name of the t...

Switching files to read from in python's .csv reader

I am reading a csv file several times, but cutting its size every time I go through it. So, once I've reached the bottom, I am writing a new csv file which is, say, the bottom half of the .csv file. I then wish to change the csv reader to use this new file instead, but it doesn't seem to be working... Here's what I've done. ...

Read file in array line by line

Can you set any index of array as starting index i.e where to read from file? I was afraid if the buffer might get corrupted in the process. #include <stdio.h> int main() { FILE *f = fopen("C:\\dummy.txt", "rt"); char lines[30]; //large enough array depending on file size fpos_t index = 0; while(fgets(&lines[index], ...