file-io

What's the correct way to do a 'catch all' error check on an fstream output operation?

What's the correct way to check for a general error when sending data to an fstream? UPDATE: My main concern regards some things I've been hearing about a delay between output and any data being physically written to the hard disk. My assumption was that the command "save_file_obj << save_str" would only send data to some kind of buffer...

Fork in Perl not working inside a while loop reading from file

Hi, I'm running a while loop reading each line in a file, and then fork processes with the data of the line to a child. After N lines I want to wait for the child processes to end and continue with the next N lines, etc. It looks something like this: while ($w=<INP>) { # ignore file header if ($w=~m/^\D/) { next;}...

What is the maximum file size 32 bit java can access?

What is the maximum file size 32 bit java can access? Is this architecture dependent? ...

Compiler issues on VC++ 2008 Express, Seemingly correct code throws errors.

Hi there, I've been trying to get back into coding for a while, so I figured I'd start with some simple SDL, now, without the file i/o, this compiles fine, but when I throw in the stdio code, it starts throwing errors. This I'm not sure about, I don't see any problem with the code itself, however, like I said, I might as well be a newbie...

Problem with File IO and splitting strings with Environment.NewLine in VB.Net

Hi, I was experimenting with basic VB.Net File IO and String splitting. I encountered this problem. I don't know whether it has something to do with the File IO or String splitting. I am writing text to a file like so Dim sWriter As New StreamWriter("Data.txt") sWriter.WriteLine("FirstItem") sWriter.WriteLine("SecondItem") sWriter.Wri...

Best directory to store application data with read\write rights for all users?

Hi guys. Until Windows Vista I was saving my application data into the directory where the program was located. The most common place was "C:\Program Files\MyApplication". As we know, under Vista and later the common user does't have rights to write under "Program Files" folder. So my first idea was to save the application data under "A...

How to read in a double from a file in c++

How do you read in a double from a file in C++? For ints I know you can use the getline() and then atoi, but I am not finding an array to double function. What is available for reading in doubles, or converting a char array to a double? ...

Need help manipulating WAV (RIFF) Files at a byte level

I'm writing an an application in C# that will record audio files (*.wav) and automatically tag and name them. Wave files are RIFF files (like AVI) which can contain meta data chunks in addition to the waveform data chunks. So now I'm trying to figure out how to read and write the RIFF meta data to and from recorded wave files. I'm using...

Lots of questions about file I/O (reading/writing message strings)

Hi, For this university project I'm doing (for which I've made a couple of posts in the past), which is some sort of social network, it's required the ability for the users to exchange messages. At first, I designed my data structures to hold ALL messages in a linked list, limiting the message size to 256 chars. However, I think my ins...

Not able to open a file in php

The code chokes at fopen(): <?php ini_set('display_errors',1); error_reporting(E_ALL); $fp = fopen("/path/to/file/some_file.txt","a") or die("can't open file"); fwrite($fp,"some text"); fclose($fp); ?> And the resulting web page says: "Warning: fopen(/path/to/file/some_file.txt) [function.fopen]: failed to open stream: Pe...

How do I overwrite X bytes on offset Y with fwrite()?

Hi, All I can find using fopen() and fwrite() in C is to delete all contents and start writing again or append to the end of the file. What if I need to go to some offset in the file and overwrite a few bytes? Is that possible with some function? ...

Cannot write to SD card -- canWrite is returning false

Sorry for the ambiguous title but I'm doing the following to write a simple string to a file: try { File root = Environment.getExternalStorageDirectory(); if (root.canWrite()){ System.out.println("Can write."); File def_file = new File(root, "default.txt"); FileWriter fw = new FileWrit...

performance implications of storing 600,000+ images in the same folder (NTFS)

I need to store about 600,000 images on a web server that uses NTFS. Am I better off storing images in 20,000-image chunks in subfolders? (Windows Server 2008) I'm concerned about incurring operating system overhead during image retrieval ...

How can I insert or remove bytes from the middle of a large file in .NET

Is it possible to efficiently insert or remove bytes from the middle of a large file, and if so how? Or am I stuck rewriting the entire file after the point where the data was inserted or removed? [A lot of Bytes][Unwanted Bytes][A lot of Bytes] - > [A lot of Bytes][A lot of Bytes] or [A lot of Bytes][A lot of Bytes] - > [A lot of Byt...

Server 2008 Task Scheduler Mapped Drive Access C#

I'm trying do get Server 2008's Task Scheduler to run a C# console app which backs up data to a mapped backup drive somewhere on FastHosts network. I've written a test app which simply does this Directory.CreateDirectory("Z:\" + DateTime.Now.Ticks.ToString()); i.e. just creates a directory on the root of this Z drive. This works fin...

C# code to perform Binary search in a very big text file

Is there a library that I can use to perform binary search in a very big text file (can be 10GB). The file is a sort of a log file - every row starts with a date and time. Therefore rows are ordered. ...

Unable to access Java-created file -- sometimes

In Java, I'm working with code running under WinXP that creates a file like this: public synchronized void store(Properties props, byte[] data) { try { File file = filenameBasedOnProperties(props); if ( file.exists() ) { return; } File temp = File.createTempFile("tempfil...

A couple questions using fwrite/fread with data structures

Hi, I'm using fwrite() and fread() for the first time to write some data structures to disk and I have a couple of questions about best practices and proper ways of doing things. What I'm writing to disk (so I can later read it back) is all user profiles inserted in a Graph structure. Each graph vertex is of the following type: typede...

Get PocketC File Handle Int?

I'm now taking a look at the PocketC powerful tool, but there is an fileopen function, that generates a integer called filehandle, that is used for most of the File I/O operations of PocketC. How do I use this int filehandle to call the other file manipulation functions? Here is my example function that I'm using at my program: fileope...

Persist changes in C

I am developing a database-like application that stores a a structure containing: struct Dictionary { char *key; char *value; struct Dictionary *next; }; As you can see, I am using a linked list to store information. But the problem begins when the user exits out of the program. I want the information to be stored somewhe...