io

Function like SetFileLength() in C Library for Linux

Is there a function in the C Library under Linux which can set the length of a file? Under Windows I know there is a SetFileLength() function. If there is not, what is the best way of shortening a file without deleting and rewriting it? ...

Saving Program Data

I'm looking for some information and a little history. I am writing a program and I want to save some data without using a database. I'm assuming I could use XML but what else can I use? How do you save data to files and then retrieve them without XML and without plain text? What is Binary formatting, can that be used? Isn't binary forma...

Java data object for bidirectional I/O

I am developing an interface that takes as input an encrypted byte stream -- probably a very large one -- that generates output of more or less the same format. The input format is this: {N byte envelope} - encryption key IDs &c. {X byte encrypted body} The output format is the same. Here's the usual use case (heavily pseudocode...

HTTP file download with Javascript

Is there any way (in Javascript) to download a remote website (i.e. like with Curl), read it into a string variable and further process it? ...

Non-blocking read on a stream in python.

Hi, I'm using the subprocess module to start a subprocess and connect to it's output stream (stdout). I want to be able to execute non-blocking reads on its stdout. Is there a way to make .readline non-bloking or to check if there is data on the stream before I invoke .readline? I'd like this to be portable or at least work under Window...

Can I use WMI to find the network usage by each process?

I'd like to use WMI on some windows systems to poll the network usage of each process. From what I can tell, there are many IO instances in the Win32_PerfRawData_PerfProc_Process but they are for the combined IO of network,disk,and device. Is there a way to break that up so I can get network and disk IO separate? ...

Writing a GIF file in Java

So I have this GIF file on my desktop (it's a 52 card deck of poker cards). I have been working on a program that cuts it up into little acm.graphics.GImages of each card. Now, however, I want to write those GImages or pixel arrays to a file so that I can use them later. I thought it would be as straight forward as writing .txt files, bu...

How to delete a file used by other process

Here's the deal. My WinApp is running, right? in let's say process 'A'.It creates a file and keeps the handle (keeps the file open for writing, this is a must). Then it starts other msbuild process, let's call it 'B'. This process is started with the System.Diagnostic.Process class. At some point, my WinApp (A) needs to delete the pre...

Java I/O using inpout32.dll

I am trying to control some LEDs wired to the parallel port on Windows XP. The easiest solution would be Inpout32.dll from Logix4u.net. I have found many source code samples in various languages (C++, Visual Basic, C#) but nothing using Java. Do you know any tutorials about calling DLL functions from Java ? (what I have found so far on ...

Check if a file is open from another process

How do I check if a file is already used by another process from Powerscript ? ...

String value that represents an email attachment, how to store to disk/db?

Ok it turns out this 3rd party component I am working with stores an email attachment in a property of string type (it is already decoded). How would I store this to file now? It has: filename, encodingtype and the string representation of the file. ...

File Watcher - get the process name that created a file in Windows?

Is there a good way to get the process name that created a file in Windows? I have a directory on a Windows 2000 Server C:\WINNT\Temp that is filling up with files named like: 70618199 21834082 They are always 121,201 KB in size. Programatically can I "capture" the program name or service name that is dropping files in this locati...

Parsing a File Format

I'm working with Quickbook's IIF file format and I need to write a parser to read and write IIF files and I'm running into some issues reading the files. The files are simple, they're tab deliminated. Every line is either a table definition or a row. Definitions begin with'!' and the table name, and rows begin with just the table name. ...

Compression to Improve Harddisk Write Performance

On a modern system can local harddisk write speeds be improved by compressing the output stream? This question derives from a case I'm working with where a program serially generates and dumps around 1-2GB of text logging data to a raw text file on the hard disk and I think it is IO bound. Would I expect to be able to decrease runtimes ...

Win32 equivalent of opendir

Would anyone know what the Win32 equivalent of opendir is (or if it even exists) ? Obviously I could use FindFirstFile(Ex) with FindNextFile, but appending * to the path seems like such a hackish way to do it. ...

Recursive File Search in .net

Hi, I need to search a drive (C:, D: etc) for a partuicular file type (extension like .xml, .csv, .xls). How do I preform a recursive search to loop all directories and inner directories and return the full path of where the file(s) are? or where can I get information on this? VB.NET or C# Thanks Edit ~ I am running into some errors ...

linux c/c++ programming telnet connection io redirection

I have a computer (say computer A) whenever computer A gets a connection over a particular telnet port, it launches a program. this program on computer A handles login, authentication etc. One of the jobs it can do is receive files. It handles this by launching gKermit. /usr/local/bin/gkermit -e 8000 -w -a /location/x/ -ir I have a s...

Tracing IO in java application ?

I am trying to find out why Apache CXF is running away doing "something" upon first-time initialization of a web-service. "Something" is probably some kind of IO, and I'm guessing it's trying to resolve an external address/schema/DTD of some sort. So I'm trying to find some kind of hook where I can monitor all IO. Either at VM level or ...

C++ I/O Rereading a file after EOF (was: Parsing a Comma Delimited Text File)

Lets take a look at the code: #include <iostream> #include <fstream> #include <string> #include <cstdio> #include <cstdlib> using namespace std; int main() { string usrFileStr, fileStr = "airNames.txt", // declaring string literal sLine; // declaring a string obj fstream inFile; ...

Creating a new file using an existing file within a jar

Let's say I have a file called test.txt within the package "com.test.io" within my jar. How would I go about writing a class which retrieves this text file and then copies the contents to a new file on the file system? ...