file-io

doing math on files.

I am writing a program in C for file compression. The method i am trying to use involves doing math on the file as if it were one long number. Can anyone recommend a bignum library that would not try to do all of that in ram, but rather let me do math with file pointers. any help would be appreciated, thanks in advance. ...

Lock Properties File in Java

Hello, I am using the java properties file construct. At the beginning I read it to populate a dialog, but I also give the users the ability to change the values in the dialog and click save. This causes me to call the setProperty method of the properties file. Now, since this webapp can exist over multiple browsers, all changing the sa...

[Android] reading unicode text from assets

Trying to read an utf-8 encoded file in android... InputStreamReader reader = new InputStreamReader(assets.open("data.txt"), "UTF-8"); BufferedReader br = new BufferedReader(reader); String line; //The line below throws an IOException!! line = br.readLine(); What's wrong with this code? ...

JavaFX Scripts do not seem to work on other computers

When I bring my app to another computer the two buttons that should either open a file browser, or take in a file path to open a file both don't work. I don't understand why. It works perfectly fine if I compile it within Netbeans. package maxsublistsum; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; impor...

.NET delete a file that doesnt exist?

I want to delete a file that may or may not exist. I write try { File.Delete(temp); } catch { } Is there an easier way? Also I realize this ignores other exceptions as well but i dont care in this case. ...

how to collect particular type of data with ruby scripting

I have 5 files file1.txt file2.txt....file5.txt then I have list of 3 words red white blue I am trying to find out how many times and in what files red white blue occur. Finally the format should be: red = file1.txt, file3.txt, 2 white = file2.txt, 1 blue = file1.txt, file2.txt, file3.txt, 3 This is what I have so far: files.each ...

How can I delete a file pointed to by a FILE* in C?

#include<stdio.h> int main() { FILE* fp; fp = fopen("temp.txt", "w"); fprintf(fp, "Hello, World!\n"); // remove("temp.txt"); this requires the filename as an argument // removefile(fp); <--- is something like this possible? return 0; } The remove function (defined in stdio.h) takes the file name as a p...

c# file UNC path LastWriteTime not working

File.GetLastWriteTime(pathname).ToString(); The line above works perfectly for a local file on my c: drive, if I try to a file on a network share using a UNC path I get "01/01/1601 00:00:00" Any ideas how to resolve? my app needs to work of UNC paths. ...

Local file access and compiling a greasemonkey script to xpi

I want to provide some functionality through an extension. This requires (read and execute) access to some resource files (an mp3 file, a swf file and two js). I know user scripts cannot access local files and I need an extension (add-on) to do that. But can I start by writing a greasemonkey script and compiling it to a xpi? How should...

Detecting a File Delete on an Open File

I am opening a file with read access and allowing subsequent read|write|delete file share access to the file (tailing the file). If the file is deleted during processing is there a way to detect that the file is pending delete (see Files section http://msdn.microsoft.com/en-us/library/aa363858(v=VS.85).aspx)? If some outside process (the...

android createTempFile throws permission denied?

This is simple, but not working. I am trying to create a temp file (later a permanent storage file) for preview of an MP3 file. I have tried the following variants of the suffix as following example: public class StudyFileIo extends Activity { private static final String TAG = "StudyFileIo"; @Override public void onCreat...

Slowdown when copying huge (120+GB) files

I have a C# application and am using the FileStream class to read a 120GB file from an *EDIT * isilon storage unit (mapped to z drive) over gigabit LAN. I start by getting 45 megabytes / second read speeds, but at about the 20GB range my read speeds drop dramatically and settles to about 9 megabytes / second. Does anyone have any ideas o...

How to add a file to an Android project, deploy it to the device, and then open it?

I have an Android (2.2) project in Eclipse (Helios). I want to add an MP3 file to the project so that the MP3 file is deployed to the device along with the application. I then would like to open the file as a File object, which means I'd need to know the full path (?) to the file on the device, but I don't know how paths are specified ...

Reading correctly from a file

During the course of my program, I pass the output of an execv() to a file, for logging, (using the outCopy() function) and then print it back on screen to simulate stdout output. (using the printFile() function) The 2 functions are: void printFile(char *fileName) { char *fileContent=(char *)malloc(200*sizeof(char)); ...

C program to merge files not finding EOF, stuck in infinite loop!

I'm having some problems trying to run this program I am working on...The requirements say I was not allowed to use a sort function...I had do something myself....etc. Pretty much, the program compiles but hangs after executed...I'm guessing it's stuck in an infinite loop...but I can't seem to find it... :( This program reads to data f...

Python 3 I think I have a type mismatch but can't find it

Hi, I'm using Python 3.1 to write a simple game involving naming state capitols. I think I have some kind of type mismatch but I don't know what it is. I think it's when I compare the player's answer to the real answer, but don't know how to make it right. from random import * states = {} print ("Guess State Capitols") statefile = o...

Search for occurrences of contents of a file in another file

Hi, I want to search the contents of files in a directory for words present in files in another directory. Is there a better way to do it than the following? (By better mean memory usage wise) More specifically: folder 1 has several files, each file has several lines of text. folder 2 has several files, each file has several words, ea...

How to read giant text file in PHP?

Hello, I have few text files with size more than 30MB. How can i read such giant text files from PHP? ...

problem writing bitmap file header in C

Hi, I am trying to create a new bitmap file using C. This is a struct for the .bmp file header. #define uint16 unsigned short #define uint32 unsigned long #define uint8 unsigned char typedef struct { uint16 magic; //specifies the file type "BM" 0x424d uint32 bfSize; //specifies the size in bytes of the bitmap file uint16 bfReserv...

How to write a multidimensional array to a text file?

In another question, other users offered some help if I could supply the array I was having trouble with. However, I even fail at a basic I/O task, such as writing an array to a file. Can anyone explain what kind of loop I would need to write a 4x11x14 numpy array to file? This array consist of four 11 x 14 arrays, so I should format i...