Assume I have a regular fixed width file that is sorted on one of the fields. Given that I know the length of the records, I can use lseek to implement a binary search to find records with fields that match a given value without having to read the entire file.
Now the difficulty is that the file is gzipped. Is it possible to do this wi...
I'm writing my first app in MFC, and I was looking to include a very simple feature : Include a "Save To File" button that on being clicked will bring up the familiar "Save As.." Dialog box and will ultimately save the data in a text file. I couldn't find how to invoke this dialog box - can someone just point me at the right way to do i...
What is the difference in writing to files atomically on the iPhone in objective-c and not, is there any performance difference between the two?
Thanks in advance!
...
I'm running a python program. When it get's to these lines:
f = open("/dev/bus/usb/007/005", "r")
x = fcntl.ioctl(f.fileno(), 0x84005001, '\x00' * 256)
It fails saying:
IOError: [Errno 1] Operation not permitted
What could be causing this problem?
...
I work mainly on Windows and Windows CE based systems, where CreateFile, ReadFile and WriteFile are the work horses, no matter if I'm in native Win32 land or in managed .Net land.
I have so far never had any obvious problem writing or reading big files in one chunk, as opposed to looping until several smaller chunks are processed. I us...
I managed to get this code to compile with out error. But somehow it did not return the strings that I wrote inside file1.txt and file.txt that I pass its path through str1 and str2. My objective is to use this open source library to measure the similarity between strings contains inside 2 text files.
Inside the its Javadoc, its states...
Hi
I am trying to dump the floating point values from my program to a bin file. Since I can't use any stdlib function, I am thinking of writting it char by char to a big char array which I am dumping in my test application to a file.
It's like
float a=3132.000001;
I will be dumping this to a char array in 4 bytes.
Code example woul...
I have a windows service which is trying to access an xml file from the Application directory.
Windows Service Installed directory : C:\Services\MyService\MyService.exe
Path of the xml file : C:\Services\MyService\MyService.xml
I am trying to access the file using the following code.
using (FileStream stream = new FileStream("MyServi...
I have a text file. I would like to retrieve the content from one line to another line.
For example, the file may be 200K lines. I want to read the content from line 78 to line 2735. Since the file may be very large, I do not want to read the whole content into the memory.
...
I'm trying to complete an exercise to write a program that takes the following command line arguments: an input file, an output file, and an unspecified number of words. The program is to read the contents of the input file line by line, find for each word given which lines contain the word, and print the lines with their line number to ...
I am trying to write to a file. I do a file_exists check on it before I do fopen and it returns true (the file does exist).
However, the file fails this code and gives me the error every time:
$handle = fopen($filename, 'w');
if($handle)
{
flock($handle, LOCK_EX);
fwrite($handle, $contents);
}
else
{
echo 'ERROR: Unable to ...
How would I go about saving several files and log the errors when something bad happens, but then keep going with the next file in sequence? Essentially I will have a collection of pdf-files that I want to save at a certain location. If an error is thrown when a file is process, the error should be logged and then the saving should conti...
Okay, so I'm working on a project where I use a Java program to initiate a socket connection between two classes (a FileSender and FileReceiver). My basic idea was that the FileSender would look like this:
try {
writer = new DataOutputStream(connect.getOutputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e...
I have large (hundreds of MB or more) files that I need to read blocks from using C++ on Windows. Currently the relevant functions are:
errorType LargeFile::read( void* data_out, __int64 start_position, __int64 size_bytes ) const
{
if( !m_open ) {
// return error
}
else {
seekPosition( start_position );
DWORD bytes_read;
BOOL...
I use the following code to retrieve image from the phone or SDCard and I use that image in to my ListField. It gives the output but it takes very Long time to produce the screen. How to solve this problem ?? Can any one help me?? Thanks in advance!!!
String text = fileholder.getFileName();
try{
String path="file:///"+fileholder.getPat...
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.
...
If I just call close() in a output stream, the output is guaranteed, or need I call flush() always?
...
How would I go about reading all files in a directory?
In C# I would get a DirectoryInfo object, and get all files into a FileInfo[] object.
Is there similar functionality in the STD namespace in C++?
...
I have an application on my server that is called leaf.exe, that haves two arguments needed to run, they are: inputfile and outputfile, that will be like this example:
leaf.exe input.jpg output.leaf
They are all on the same directory as my home page file(the executable and the input file). But I need that a VBScript could run the appl...
Is there any difference between these two methods of moving a file?
System.IO.FileInfo f = new System.IO.FileInfo(@"c:\foo.txt");
f.MoveTo(@"c:\bar.txt");
//vs
System.IO.File.Move(@"c:\foo.txt", @"c:\bar.txt");
...