file-io

C/C++ library for VTK IO

I have a simulation in C++ which generates huge amount of data. Right now I am using MATLAB libraries to save the results as a .mat file, but eventually I will be needing an open source binary format. I don't want to implement my own binary format and ASCII is not an option. I heard that VTK provides .vtk binary file format for saving 3d...

How do I find the last modified file in a directory in Java?

How do I find the last modified file in a directory in java? ...

Alternative to Process.Start()

Hi, I'm just finishing off coding a a document storage solution and I've run across the following issue. Within the UI the user can press a button to open a file: try { Process.Start(file); } catch (Exception ex) { //Error handling code } My ...

Get Web App root from Spring Controller

I am trying to write an uploaded multipart file to the filesystem. I have a directory called audio which sits in the root of my web application (not inside WEB-INF, but beside it, to it's publicly accessible like css and javascript). I want to write the uploaded file to that directory but I can't seem to get the path I need. I thoug...

Efficient File I/O and Conversion of Strings to Floats

I have some gigantic (several gigabyte) ASCII text files that I need to read in line-by-line, convert certain columns to floating point, and do a few simple operations on these numbers. It's pretty straightforward stuff, except that I'm thinking that there has to be a way to speed it up a whole bunch. The program never uses the equival...

Open a file from a remote network share

I am trying to open a file from a server I currently have Dim attachedFilePath As String = "\\myserver\myshare\test.txt" File.Open(attachedFilePath, FileMode.Open, FileAccess.Read, FileShare.Read) This does not open a file. However, if I change the path to be local then there is no issue. Dim attachedFilePath As String = "c:\...\t...

Reading File Data Into a Linked List in C

I am trying to create a simple phonebook program that reads data from a file and stores the content into specific nodes in the list. It works fine if I use my addEntry function with static data, such as: addEntry("First", "Last", "555-555-5555"); If I try to read more than 1 entry from the file, each entry just appears to be whatever ...

Read from file, clear it, write to it

I'm trying to read data from a text file, clear it, and then write to it, in that order using the fstream class. My question is how to clear a file after reading from it. I know that I can open a file and clear it at the same time, but is there some function I can call on the stream to clear its contents? ...

How to create/write file in the root of the android device?

I found out that you can use something like this to create a file: FileOutputStream fs = openFileOutput("/test.in", MODE_WORLD_WRITEABLE); String s = "[Head]\r\n"; s += "Type=2"; byte[] buffer = s.getBytes(); fs.write(buffer); fs.close(); When running the above code I get an IllegalArgumentException stating: java.lang.IllegalArg...

Exit from while loop when stream closed?

This is a network stream problem but i simplified test case to Console input: i started a thread ehich waits 2 seconds and closes the stream reader. But after closing stream/stream reader. While loop still waits for sr.ReadLine() method. i wan't to make it exit loop automatically when closes the stream/stream reader. i tried also the th...

Copy to output directory issue with .inf file

Apologies if dup, I did try searching several times and found nothing like it... I have a number of 'config' files that my application edits. Really it is just a gui for editing these files as they have a special format. Anyway, everytime I put a new group of files in visual studio, and select "Copy to Output directory" to "Copy always"...

Reading text files

I'm trying to find out what is the best way to read large text (at least 5 mb) files in C++, considering speed and efficiency. Any preferred class or function to use and why? By the way, I'm running on specifically on UNIX environment. ...

How to read file headers in Python similar to C?

I am new to Python. I am a C programmer by profession. I have file, whose header has some specific data, that I need to extract. For example, Byte 0-5 has a magic, Byte 6-8 has offset etc. In C (An Example) : struct { int32_t payload_offset, int32_t len, char *magic, int32_t type int32_t header_size } file_hd...

Ruby - How to prevent wiping your hard drive when using delete file and directory commands in your code

I'm writing some code that at run time may create or delete directories within the project path. I haven't really used ruby for file processing so i'm really uneasy about having code that, with a few mistypes weeks down the line, could result in wiping other directories outside of my project path. Is there anyway to make it impossible ...

Force rename a file in Java

Can I use any utility to do a force rename of a file from Java.io? I understand that Java 7 has these features, but I can’t use it... If I do a File tempFile = File.createTempFile(); tempFile.renameTo(newfile) and if newfile exists then its fails. How do I do a force rename? ...

How to print out a backslash in LaTeX

Hi, I want to write a backslash character to a text file using LaTeX. The first line of code below declares a variable 'file' which describes the file 'myfile.out'. The second line opens the file and the third one tries do write a backslash '\' to the file. \documentclass{article} \begin{document} \newwrite\file% \immediate\open...

Can I change write access for root directory? Sygic Navigation and their API...

I need to be able to write textfiles to the root directory of my Android device (as this related questions explains). Can I change write permissions for root directory / and if so, how? I tried pushing a file using adb, but it said file system was read-only =( Its pretty annoying that I cannot control my own device, that everything is...

Download a string as a file

When the user clicks a button, I want to build a string, then have the user download that string as a file (it's a CSV file). var response = HttpContext.Current.Response; response.ClearContent(); response.Clear(); byte[] bytes = Encoding.ASCII.GetBytes(csvtext); using (var stream = new MemoryStream(bytes)) { ...

Is Silverlight able to change a file on a local user's computer?

I considering writing an application in C#/.NET that will programmatically alter an XML file on a user's computer and I trying to determine if Silverlight (and which versions, in what modes) will work for this task. Here's the workflow: User selects file Application modifies file Application saves file, overwriting original file Is ...

Help opening a file in Visual Studio 2008

I'm trying to use Visual Studio 2008 since I had problems opening a file in XCode. I am new to VS, but these are the steps I took. I created a new project, selected Win32 Console Application, empty project. My code is: // C_test.cpp : Defines the entry point for the console application. // #include <stdio.h> #include <stdlib.h> int ...