file-io

File size from ejb 2.1

How can I find the size of the file/directory from an ejb. I understand access of system resources are not allowed according to the ejb specification. But is this an rule. ...

NT FileManagement functions

I have been analysing Ntdll file system functions from the total ntdll function list. First, I obtain the total function list from ntdlls export directory. Next, I seperated the file management set from the total function list and tried hooking the entire file management set. However, I miss to hook a function, which i dint know. Hence...

problem hooking NT dll file functions!

Hello all, what is the best tool to track the NT API's. ...

How to find if an NTFS logical cluster is free?

I would like to write a program that reads all the unused clusters on an NTFS volumne. (I'm looking to recover data from a file that was accidentally truncated). According to this page I can call SetFilePointer() and ReadFile() on the volume handle to go through each logical cluster on the volume. But how do I know which clusters ar...

How do I open a transacted file in C#

I understand W7 support transacted files. How do I use them in C#? ...

How to programmatically search for a folder in a user's environment in C#?

I would like to be able to search for a folder by name within a user's files in C#. The reason for this is to enable a process which utilizes two applications that are otherwise not communicating with one another. (The process is essentially a file hand off, and the applications cannot communicate as one is a proprietary app). If this is...

Where to store custom configuration files

I currently store a serialized XML file in the application directory that contains all changes specific to the program operation (not typical system or user configuration). Weeks ago, we started running into problems where it would not save correctly (read my previous question about this). Long story short, we finally discovered that W...

c# Cannot delete log file after process stopped

I have many processes on a server which Im attempting to stop, delete the log files, and eventually restart. My problem is that once all the processes stop (even the one that writes to the log file), Im unable to programatically delete the log files (but I can manually). The error I receieve is "the process cannot access the file bec...

Why should files be mounted in Linux

Hello, I got an old library which does some manipulation with files on floppy\ CD (transferring the files on network paths). This library has a thread which checks on each second whether the file (e.g. the floppy diskette\ the CD disk) is mounted. Why? What operations can be done only on mounted files? Thanks a lot. ...

Saving a C struct with a char* string into a file

I'm trying to save a struct with a char* string into a file. struct d_object { int flags; int time; int offset; char *filename; }; The problem is that when doing that I will obviously only save the address of that pointer rather than the string. So what I've done is simply use a character array and but I'm forced to ...

MS Visual c++ 2008 char buffer longer than defined

I've got a char* buffer to hold a file that i read in binary mode. I know the length of the file is 70 bytes and this is the value being used to produce a buffer of the correct size. The problem is, there is 17 or 18 extra spaces in the array so some random characters are being added to the end. Could the be a unicode issue? ulFLen stor...

Exporting diectory structure to csv/xl file

Hi all, my requirement is to enumerate all directories and specific .tif files (that are at the end of the structure). Sample is A (path selected from UI) <has> B<has> and C<has> D <has> E F G H I J K ...

Lock file for writing/deleting while allowing any process to read.

I am developing an application in C# (.NET), and am having trouble dealing with file locking. My main application (A) needs read/write access to a certain file. A separate application (B) needs read access to the same file. I need to prevent the user from editing or deleting the file while my application (A) is running. The applicatio...

File.Create is appending to the file rather than overwriting it.

Sorry all, but there was some other problem. The code is now working correct. Thanks all. I have the following code for creating a file if it does not exist and overwriting it if it already exists: FileStream fsExe = File.Create(DestExePath, 4096); BinaryWriter bw = new BinaryWriter(fsExe); What ever I write to the BinaryWriter, i...

How to add a Browse To File dialog to a VB.NET application

In a VB.NET Windows Forms application how do I add the capability for someone to click a button or image and open a file browser to browse to a file and assign it's path to a variable so I can copy that file to another specific path? ...

How to remove a non-empty directory in C++?

In C++, how can I remove a directory with all its contained files? I know there is rmdir, but it will only remove non-empty directories, so how do I list and remove all contained files first? I know it shouldn't be hard using Boost Filesystem, but I kind of want to avoid building and depending on it just for this one little task ... ...

Reading / Writing text file repeatedly / simultaneously

Hello, How do I read and write on a text file without getting the exception that "File is already in use by another app"?? I tried File.readalltext() and File.Appendalltext() functions..I'm just starting out with filestream. Which would work out best in my scenario? I would appreciate some code snipplets too .. Thanks ...

How to read the content from a (local) file with SpiderMonkey on the command line?

I want to use SpiderMonkey for driving a test harness (for the in-browser version see here). Now, I tried the following: var defaultFileName = "all.n3"; var reader = new FileReader(); reader.readAsText(defaultFileName); reader.onload = fileLoaded; which fails with the following error: regression-tests.js:9: ReferenceError: FileReader...

Read from a log file as it's being written using python

Hi, I'm trying to find a nice way to read a log file in real time using python. I'd like to process lines from a log file one at a time as it is written. Somehow I need to keep trying to read the file until it is created and then continue to process lines until I terminate the process. Is there an appropriate way to do this? Thanks. ...

How to write only regularly spaced items from a char buffer to disk in C++

How can I write only every third item in a char buffer to file quickly in C++? I get a three-channel image from my camera, but each channel contains the same info (the image is grayscale). I'd like to write only one channel to disk to save space and make the writes faster, since this is part of a real-time, data collection system. C++...