io

Type of Linux/Unix I/O

hi guys, i have to make a presentation about Linux/Unix I/O: File I/O,Standard I/O, buffered/unbuffered I/O and formatted/unformatted I/O. i'm not sure how to order these kinds of I/O to make sense. here is my try: file I/O unbuffered I/O buffered I/O Standard I/O formatted/unformatted I/O is this correct ?? thx anyway ...

Java Implementing htonl

I am communicating with a server, each message sent to the server has to be padded with the length of the message, unsigned int len = htonl(msg.size()); In C running the length through htonl and padding the message works, in Java AFAIK byte order is already in network order so I assumed all I have to do is write the string length befo...

Is there a Bioperl equivalent of IO::ScalarArray for array of Seq objects?

In Perl, we have IO::ScalarArray for treating the elements of an array like the lines of a file. In BioPerl, we have Bio::SeqIO, which can produce a filehandle that reads and writes Bio::Seq objects instead of strings representing lines of text. I would like to do a combination of the two: I would like to obtain a handle that reads succe...

Rapid Opening and Closing System.IO.StreamWriter in C#

Suppose you have a file that you are programmatically logging information into with regards to a process. Kinda like your typical debug Console.WriteLine, but due to the nature of the code you're testing, you don't have a console to write onto so you have to write it somewhere like a file. My current program uses System.IO.StreamWriter f...

Determine whether a folder is present?

How would I go about determining whether a file or directory has been created in Java? I basically want to create a data directory if one is not already present. Thanks. ...

How to load/save C++ class instance (using STL containers) to disk

I have a C++ class representing a hierarchically organised data tree which is very large (~Gb, basically as large as I can get away with in memory). It uses an STL list to store information at each node plus iterators to other nodes. Each node has only one parent, but 0-10 children. Abstracted, it looks something like: struct node { pub...

How to pass a file (read from Java) most effectively to a native method?

Hi, I have approx. 30000 files (1MB each) which I want to put into a native method, which requires just an byte array and the size of it as arguments. I looked through some examples and benchmarks (like http://nadeausoftware.com/articles/2008/02/java_tip_how_read_files_quickly) but all of them do some other fancy things. Basically I d...

VB6: Slow Binary Write?

Wondering why a particular binary write operation in VB is so slow. The function reads a Byte array from memory and dumps it into a file like this: Open Destination For Binary Access Write As #1 Dim startP, endP As Long startP = BinaryStart endP = UBound(ReadBuf) - 1 Dim i as Integer For i = startP To endP DoEvents Put #1, (i...

Having an issue with overwriting an element of a file correctly (numeric)

This is an ATM style program, but currently it doesn't do exactly what I need it to do... I need to get the current balance, and when money is transferred from either checking or savings, it should add it to checking and subtract it from savings. which is does, but not correctly... Input example -=[ Funds Transfer ]=- -=[ Savings to C...

How do I load resource using Class Loader as File?

I want to open files using the class loader. However I always get a FileNotFoundException. How do I create a new File using the URL? I don't want to open it as a stream just as a file. URL url = VersionUpdater.class.getResource("xslt/screen/foo"); File f = ... ...

C# move file as soon as it becomes available.

Hi, I need to accomplish the following task: Attempt to move a file. If file is locked schedule for moving as soon as it becomes available. I am using File.Move which is sufficient for my program. Now the problems are that: 1) I can't find a good way to check if the file I need to move is locked. I am catching System.IO.IOException b...

BufferedReader in a multi-threaded environment

How to read from BufferedReader simultaneously by multiple threads. ...

access to the path is denied C#

When I am running the application I can access the file.. When I am running the executable that is created, I cannot access the file.. Any suggestions? The error I am getting is : access to the path 'E:\Javascript.js' is denied. ...

Android file-creation fails.

I use the following code to create a folder "mymir" and a file ".nomedia" (in the mymir-folder) on the sdcard of an android unit. However, somehow it fails with the exception that the folder the ".nomedia"-file is to be placed in dosn't exist. Here's the code: private String EnsureRootDir() throws IOException { File sdcard = Environ...

Write physical table to csv file

Hi, I was wondering if anyone knows how to write an actual table/grid to a csv file....i dont mean the content of the table/grid, i mean the actual grid lines etc etc, headers, axis..... Thanks greatly in advance. U. ...

Java I/O: How to append to an already existing text file.

Hi I am having no problem writing to or appending to a file, the only problem is that as soon as I quit the program and then run it again, it creates a new file overwriting my original file. This is a problem, as I am using the text file to keep a running tally. Is there a way to get an already created text file as an object and then ap...

Java without gc - io

Hi Guys I would like to run a Java program with garbage collection switched off. Managing memory in my own code is not so difficult. However the program needs quite a lot of I/O. Is there any way (short of using JNI for all I/O operations) that I could achieve this using pure Java? Thanks Daniel ...

loading data from file into 2d array

I am just starting with perl and would like some help with arrays please. I am reading lines from a data file and splitting the line into fields: open (INFILE, $infile); do { my $linedata = <INFILE>; my @data= split ',',$linedata; .... } until eof; I then want to store the individual field values (in @data) in and array so that the ar...

Java Scanner won't follow file

Trying to tail / parse some log files. Entries start with a date then can span many lines. This works, but does not ever see new entries to file. File inputFile = new File("C:/test.txt"); InputStream is = new FileInputStream(inputFile); InputStream bis = new BufferedInputStream(is); //bis.skip(inputFile.length()); Scanner src = new Sca...

FreeRTOS queues for IO before scheduler starts (or after it stops)

I'm looking for advice on how to best implement thread-safe IO (e.g. for printf going to a debug serial port) in an environment in which the operating system scheduler may yet to have started, be running, suspended or may have stopped or crashed. I'm using Newlib and FreeRTOS. At the moment, I'm doing the (seemingly-standard) FreeRTOS ...