I've encountered a bug I can't seem to find any logic behind. I have this File object, which is created like this:
File file = new File("utilities/data/someTextFile.txt");
I then do file.exists() and it returns false (!?). If the file is not found, I'm logging f.getAbsolutePath() to a file. When I look at the path, it seems OK. I can ...
I have a program that looks something like this:
public partial class It
{
static StreamWriter logging
= new StreamWriter(new FileStream(@"C:\log",FileMode.Create));
void someFn()
{
logging.WriteLine("foo");
logging.Flush();
/// killed here in debugger with Shift+F5
}
}
The problem it tha...
I was wondering how to convert a file I have on my server (pdf/excel/ppt) to a ByteArray. The reason I want to do this is to display the dialogue open/save as to the user and I must set the Content-Type to octet-stream. The dialogue shows fine with just navigateToURL() but for pdf's it is the user's local browser setting. For a URLReques...
how can i access the summary of a file like music file (any format) and edit it and especially the artwork of this file(the photo that are included in the file) and edit it too?
thanks.
...
I am getting this error while executing my Perl script. Please, tell me how to rectify this error in Perl.
print() on closed filehandle MYFILE
This is the code that is giving the error:
sub return_error
{
$DATA= "Sorry this page is corrently being updated...<p>";
$DATA.= "<A href=\"javascript:history.go(-1)\"> Back </A>";
...
There are a lot of programs, Visual Studio for instance, that can detect when an outside program modifies a file and then reload the file if the user wants chooses. Is there a relatively easy way to do this sort of thing in C++ (doesn't necessarily have to be platform independent)?
...
Edit: After using a bmp at toastie's suggestion, I'm still having problems loading the image:
I'm using SDL and OpenGL with Xcode and I'm trying to load an image to use as a texture on a cube. The image is a 256x256 RBG jpeg. The image is in the same directory as all of my source code, and it's under the Resources folder in the Xcode pr...
Win32 ReadFileEx is defined as:
BOOL WINAPI ReadFileEx(
__in HANDLE hFile,
__out_opt LPVOID lpBuffer,
__in DWORD nNumberOfBytesToRead,
__inout LPOVERLAPPED lpOverlapped,
__in_opt LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);
I am trying to figure out how to make the completion routine (the last arg...
Solution:
It turns out I wasn't checking the path that it was looking up, quite silly of me. Once I tracked that problem down and corrected the offending path, the reading worked just fine. Still baffled at the MSSQL issue, since the articles average less than 10 000 bytes.
Clarification:
I am unsure if some of you are under the imp...
Suppose I have a program running that periodically adds information to a .CSV file. Is there a way to write to the file while it is already open in Excel? Obviously the changes wouldn't be noticed until the file was re-opened in Excel, but as it stands right now, I'm catching IOException and just starting a new .csv file if the current...
How can I find out the maximum number of file handles that can be open at once on a windows mobile device?
I am running a native C++ application on a windows mobile proffesional emulator and there seems to be a limit of 39 open file handles (strange number I know), where any other files I open after that returning the error code 5 (ERRO...
Hi,
I have my own data structure written in C# (the structure is quite complex). I need to serialize and deserialize the structure. The size of the serialized file in disk can be pretty large at times (close to a 1 GB) but it can be small also (based on the number of records stored). I have the following requirements:
The serializatio...
I have
f = File.new(contacts_file_path, "wb")
f.write params[:uploaded_file].read
f.close
I want
begin
f = File.new(contacts_file_path, "wb")
f.write params[:uploaded_file].read
rescue
#error
ensure
if f.open? then f.close end
end
But f.open? is not a function and I can't find any api documentation. Any ideas?
...
I've created a python script that gets a list of files from a text file and deletes them if they're empty. It correctly detects empty files but it doesn't want to delete them. It gives me:
(32, 'The process cannot access the file because it is being used by another process')
I've used two different tools to check whether the files a...
I've always opened my files two ways -- either read access and shared-read, or read/write access and no sharing.
To me it seems that allowing shared-write could always result in unexpected things happening to the file while you're reading it. Are there any good reasons to open a file in shared-write mode?
...
I have a resource file for a program, and i have determined that the resource file just a big string of files glued together whole, i know that the movies contained in the file are quicktime mov. Where can i find information on the quicktime header? and how can i determine the length of a file once i find it?
...
Hi,
I have a small utility that deletes files from folders using .NET's FileInfo.Delete() method. Basically, I can catch an IOException if the file is currently open. This works for all files except for image files (JPG, GIF, BMP, ect.). When these types of files are open, the program is still able to delete them without throwing any...
As many would have discovered .net does not handle long paths names well.
So when will .net support long paths natively?
By natively I mean with out any of the suggested workarounds like subst and pinvoke
Some reading:
http://blogs.msdn.com/bclteam/archive/2007/03/26/long-paths-in-net-part-2-of-3-long-path-workarounds-kim-hamilton.as...
I need to write some system log data (usually not more than 100 characters at a time) into a log file based on particular events. But the size of this log file is small (say around 4KB), and I need to wrap around the logs when the file size hits the limit. While wrapping around, I need to preserve the latest info, and later on present it...
Hello everyone,
How can I make the code below to read correct text. In my text file has Hello welcome to C++, however at the end of the text, it has a new line. With the code below, my readBuffer always contains extra characters.
DWORD byteWritten;
int fileSize = 0;
//Use CreateFile to check if the file exists or not.
HANDLE hFile =...