file-io

is it possible to create an in-memory file and access it with FileInfo?

I want to FTP a file, and I am using the FileInfo class for certain things. Would it be possible to create an in-memory file and initialize FileInfo with it? How could I then write the file to disk if I wanted to afterwards? ...

To Log Or To Not Log?

I'm now building a program that is a eBook manager, reader, organizer and publisher, that is also a eBook transfer(to eReaders like Kindle), but I was developing it and a question have poped-up on my mind: "Log or not?" Then I started to think about logging. As many programs log actions, I started to seek for they and see how they log t...

can I check if a file exists at a URL?

I know I can locally, on my filesystem, check if a file exists: if(File.Exists(path)) Can I check at a particular remote URL? ...

How to copy a file to another path?

I need to copy a file to another path, leaving the original where it is. I also want to be able to rename the file. Will FileInfo's CopyTo method work? ...

How to check if file is/isn't an image without loading full file? Is there an image header-reading library?

edit: Sorry, I guess my question was vague. I'd like to have a way to check if a file is not an image without wasting time loading the whole image, because then I can do the rest of the loading later. I don't want to just check the file extension. The application just views the images. By 'checking the validity', I meant 'detecting and...

Need help on asynchrous non-blocking file loading with boost::asio and boost::iostreams ( or something different? )

I'm coding in c++, and I'm trying to load an image file asynchronously. After some research, I found some mentions about using boost::asio and boost::iostreams to do it. However, the documentation and example for boost::asio is mostly socket related, so it doesn't help me much. Here is what I need: Load a file asynchronously and upon ...

Need file signatures for different database types.

I've been assigned the task of creating an import utility as part of our application, and as part of the requirements, we need to be able to import from as many different file types as possible. For the most part, this is fine, the initial loading of data comes from a component that then passes it up so we can put everything in it's pro...

Storing several data into a file

Hi Can somebody give me some tips about storing a lot of data into a file? For example: I'm creating an audio sequencer with C++, and I want to save all the audio sample names (the file paths), info about the audio tracks in the project (name, volume, mute, solo, etc.) and where the samples are placed on the timeline into a file. I re...

Win32 files locked for reading: how to find out who's locking them

In C++ (specifically on Visual C++), sometimes you cannot open a file because another executable has it opened and is not sharing it for reads. If I try to open such a file, how can I programatically find out who's locking the file? ...

File Operations in Android NDK

I am using the Android NDK to make an application primarily in C for performance reasons, but it appears that file operations such as fopen do not work correctly in Android. Whenever I try to use these functions, the application crashes. How do I create/write to a file with the Android NDK? ...

Deleting Files in Python

I want to delete all files with the extension bak in a directory. How can I do that in Python? ...

Is there any way I can speed up the opening and hashing of 15,000 small files in C#?

I'm working on SHA1 checksum hashing 15,000 images (40KB - 1.0MB each, approximately 1.8GB total). I'd like to speed this up as it is going to be a key operation in my program and right now it is taking between 500-600 seconds. I've tried the following which took 500 seconds: public string GetChecksum(string filePath) { ...

How can I rename files to a unique name that is fool proof in C#?

My app needs to copy/move thousands of files throughout the day to a directory. I need to ensure that when I copy over these files I rename them to something that is unique for that directory. I have no requirements for the names other than they need to obviously be unique. What is the proper way to handle this? Should I use some kin...

Show Hexadecimal Numbers Of a File

I want to build a bash program that can read a file, like a *.bin and print all its hexadecimal numbers, as 'hex' editors do. Where I can start? ...

Print Hexadecimal Numbers Of a File At C And C++

I'm now developing a home project, but before I start, I need to know how can I printcout the content of a file(*.bin as example) in hexadecimal? I like to learn, then a good tutorial is very nice too ;-) Remember that I need to develop this, without using external applications, because this home project is to learn more about hexadeci...

Substituting 0A For \n

I'm at the time beginning the development of a simple hex editor(that only reads at the time). I want to substitute OA for "\n", I'm trying with this code: #include <iostream> #include <fstream> #include <iomanip> using namespace std; int main() { ifstream infile; int crtchar = (int)infile.get(); infile.open("test.txt", ifstre...

reading/writing to files so it works in both a linux/windows environment

If someone installs my java application on their computer (windows/linux/mac), how can I make sure my applications ability to read/write files works in all environments. Is there a way for my application to figure out where in the file system it is installed, and then read/write safely? Note: these files that are being read/written a...

How to handle temporary files in an ASP.NET application

Recently I was working on displaying workflow diagram images in our web application. I managed to use the rehosted WF designer and create images on-the-fly on the server, but imagining how large the workflow diagrams can very quickly become, I wanted to give a better user experience by using some ajax control for displaying images that w...

Determine which process (b)locks a file, programmatically (under Windows >= XP)

How to programmatically determine from a process P, which other process P' has a lock on a file, that prevents P from recreating that file ? I know there are tools to do that, but how do they achieve that ? (Context: a batch program that runs overnight fails because of a locked file. Running an admin tool the next day may be too late t...

Check For Updates

I'm developing a application in Lazarus, that need to check if there is a new version of a XML file on every Form_Create. How can I do this? ...