file-io

VB 2008 read and equals problems

I'm trying to read a binary file 2 characters at a time and see if it equals a value. I can not assign a value to the variable I want it to compare to the read value. For example, I want it to stop at the hex value 0x1188, so I'm doing: Dim fs As FileStream = New FileStream(filepath, FileMode.Open) Dim r As BinaryReader = New BinaryRe...

jboss: accessing file resource through java code?

I am reading properties file from java DAO implementation for loading properties object as in code given below this.getErrorproperties().load( new FileInputStream(new File("").getAbsolutePath() + "/conf/error/error.properties")); While testing it works fine but when i try to deploy applicat...

iPhone : Unable to copy from MainBundle to NSDocumentDirectory

Hi, I am trying to copy a couple of image files from my MainBundle/SampleImages folder to the application NSDocumentDirectory/Library folder, but am unable to do so. I have checked that the images are in .app/Mainbundle/SampleImages directory and I have also checked that the Library folder is being created in the NSDocumentsDirectory, ...

Resuming a large file write in Python

I have a big file transfer (say 4gb or so) and rather than using shutil, I'm just opening and writing it the normal file way so I can include a progress percentage as it moves along. It then occurred to me to try to attempt to resume the file write, if for some reason it borked out during the process. I haven't had any luck though. I p...

Why does fopen fail the first time, but work the second time?

Hi, I am using Matlab to create a new file by calling fid = fopen(filename,'w') since filename doesn't exist, it should create a new file and give me a valid file descriptor. Instead it returns -1. If I run the code again however, I get fid = 3. This is being run on ubuntu but it apparently works fine on windows and I can't figure ...

Extended Log File Format Parser in Ruby

Hi, I'm looking for a ruby parser for the W3C Extended Log File Format. http://www.w3.org/TR/WD-logfile.html Ideally it would generate a multidimensional array based on the fields in the log file. I'm thinking something similar to how FasterCSV (http://fastercsv.rubyforge.org/) handles CSV files. Does anyone know if such a library ex...

Linux Multi-Threaded Performance Enhancements for File open()

Hello all, I’m working on tuning performance on a high-performance, high-capacity data engine which ultimately services an end-user web experience. Specifically, the piece delegated to me revolves around characterizing multi-threaded file IO and memory mapping of the data to local cache. In writing test applications to isolate the tim...

how does BufferedReader keep track of what line has been read?

I'm reading lines from a file, and I believe that once I've read all the lines, I get an exception because of my while loop condition. Exception in thread "main" java.lang.NullPointerException at liarliar.main(liarliar.java:79) ... the code... // read the first line of the file iNumMembers = Integer.parseInt(br.readLine().trim()...

fread returns zero

I have a function that reads a rom file into memory and automatically allocates to fit the file but every time I try to read from the file descriptor, fread() returns zero. I'm unsure what I'm doing wrong. can anybody help? int read_rom(const char *filename, unsigned char ***rom) { int rom_size; FILE *fd = NULL; if((fd = fopen(file...

Programatically determining the cause of IOException?

Is there any way to programatically differentiate between what caused an IOException? For example java will throw an IOException, if there was an error during writing. How can i tell, if its something like access violation, if the Disk is out of free space, if someone disconnected the the network drive, or other things. I can't really ...

Is there a tried and true way of accessing specific areas of a very large (>1GB) binary file very fast in .Net

Using a very large raw binary data file, I will be creating a large binary file (greater than 1 GB, usually greater than 4 GB) that contains sensor data from an arbituary number of sensors (1 to 64). The new processed file will be used by user in a GUI where they will be jumping around the file looking at different time periods or other ...

How do I populate a "ragged" array with values of a text file being read?

Hello, I'm new to Stack Overflow, and this is my first question/post! I'm working on a project for school using Java. The first part I'm having trouble with inolves: Read each line in a file (listed at the end of my post) one time Create a "ragged" array of integers, 4 by X, where my 4 rows will be the "region number" (the number found...

In a python script, how can I save the contents of a string to file, and the file is in current directory?

In a python script, how can I save the contents of a string to file, and the file is in current directory? i.e the same directory as the test.py script file ...

how can i read file from jar in java?

I want to read xml file which inside one of the jar included in my class path. I want to know that how can i read any file which is included in jar? ...

PHP and file attributes accros operating systems

Can comebody tell me how to determine if a file is marked as hidden using only PHP functions? This applies especially on Windows and Linux. ...

How to open a .dat file in java program

I was handed some data in a file with an .dat extension. I need to read this data in a java program and build the data into some objects we defined. I tried the following, but it did not work FileInputStream fstream = new FileInputStream("news.dat"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedRe...

how do i open ALL the excel files one by one and run a macro

I need to write a macro in VBA that will open every file in a given directory one by one and run a macro on them. so far i have something like for i = 1 to number_of_files open Dir("C:\yourPath\*.*", vbNormal) call some_macro close file next i ...

Get Selected Image File Location in Android

I am currently making an app which works with images. I need to implement functionality where the user picks a file stored on the SD card. Once they pick the picture (using the Android gallery), the the file-location of the image will be sent to another Activity, where other work will be done upon it. I have seen similar posts here on...

file operation write is not happening in new line

Hi following code sample seems to have some problem or either it has to do something with OS internals. #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> static void usage(); #define MONC_AM_CONF "/tmp/monc.c...

Reding all content from a text file - C

I am trying to read all content from a text file. Here is the code which I wrote. #include <stdio.h> #include <stdlib.h> #define PAGE_SIZE 1024 static char *readcontent(const char *filename) { char *fcontent = NULL, c; int index = 0, pagenum = 1; FILE *fp; fp = fopen(filename, "r"); if(fp) { while((c = ge...