I have taken an example straight out of the MSDN. I want to create a file and write to it straight away. I was hoping to use FileInfo objects. So I create a new FileInfo object, call the Create and then open a FileStream. When I try to open the FileStream I get an exception telling me that another process is using the file. (Yes me).
I...
where does DotNetZip get it's root directory for saving. All the save examples don't show the directory.
My goal is to recurse a folder and subfolders. In each folder I want to zip all the files into one zip and delete the source files.
private void CopyFolder(string srcPath, string dstPath)
{
if (!Directory.Exists(ds...
This program is supposed to read files and write them. I took the file open checks out because they kept causing errors. The problem is that the files open like they are supposed to and the names are correct but nothing is on any of the text screens. Do you know what is wrong?
#include<iostream>
#include<fstream>
#include<cstdlib>
#incl...
I have to mount a WebDav location and wait for the operation to be finished before to proceed (it's a script).
So I'm using the library in this way:
location = gio.File("dav://server.bb")
location.mount_enclosing_volume(*args,**kw) # The setup is not much relevant
location.get_path() # Returns None because it's not yet mounted since the...
I'm doing it like this now, but i want it to write at the beginning of the file instead.
f = open('out.txt', 'a') # or 'w'?
f.write("string 1")
f.write("string 2")
f.write("string 3")
f.close()
so that the contenst of out.txt will be:
string 3
string 2
string 1
and not (like this code does):
string 1
string 2
string 3
...
I'm creating a utility in C++ to be run on Linux which can convert videos to a proprietary format. The video frames are very large (up to 16 megapixels), and we need to be able to seek directly to exact frame numbers, so our file format uses libz to compress each frame individually, and append the compressed data onto a file. Once all fr...
Hi All,
I am using C# in an application and am having some problems with a file becoming locked.
The piece of code does this,
while (true)
{
Read a packet from a socket (with data in it to add to the file)
Open a file // one of these randomly throws an exception saying that the file is locked
Writes data to it
Close a file...
This isn't a direct coding question but more of a OS handling mechanism. I was reading somebody's previous question regarding C# and file handling. Apparently C# was throwing an exception regarding a file being locked when trying to access this. So my question is, does C# use an internal lock to handle file I/O between processes, or does...
I have a script in python that needs to read iso-8859-1 files and also write in that encoding.
Now I am running the script in an environment with all locales set at utf-8. Is there a way to define in my python scripts that all file acces have to use the iso-8859-1 encoding?
...
Hello
Can you please provide answer to some of these?
Thanks
...
I am trying to open a file which normally has content, for the purpose of testing i will like to initialize the program without the files being available/existing so then the program should create empty ones, but am having issues implementing it. This is my code originally
void loadFiles() {
fstream city;
city.open("city.txt", ios::...
Hi. I'm trying to read the contents of a file into my program but I keep occasionally getting garbage characters at the end of the buffers. I haven't been using C a lot (rather I've been using C++) but I assume it has something to do with streams. I don't really know what to do though. I'm using MinGW.
Here is the code (this gives me ga...
Hi all,
I'm having a problem with processing a largeish file in Python. All I'm doing is
f = gzip.open(pathToLog, 'r')
for line in f:
counter = counter + 1
if (counter % 1000000 == 0):
print counter
f.close
This takes around 10m25s just to open the file, read the lines and increment this counter.
In...
Hi all,
I am having intermittent issues saving the response HTML in HtmlUnit.
Caused by: java.io.IOException: Unable to save file:C:\ccview\PP50773_4.0_walter\TSC_hca\Applications\HCA_J2EE\HCA\target\HtmlUnitTests\single\1\com\pnc\tsc\hca\ui\test\SiteCrawler\crawlSiteAsProvider\10.SiteCrawler.crawl.html
at com.pnc.tsc.hca.ui.util.G...
Hi, I've scavenged on every single topic on this forum to try and find an answer before I posted this. Most people say you should simply use SWFUpload, some others mention Activex, and it keeps going.
I know this is do-able, as Google does it with gMail when you try to upload a file that's bigger than 25mb, or executable.
My question i...
Is there a not so ugly way of treat the close() exception to close both streams then:
InputStream in = new FileInputStream(inputFileName);
OutputStream out = new FileOutputStream(outputFileName);
try {
copy(in, out);
} finally {
try {
in.close();
} catch (Exception e) {
try {
// event...
I have a file that was written with the following Delphi declaration ...
Type
Tfulldata = Record
dpoints, dloops : integer;
dtime, bT, sT, hI, LI : real;
tm : real;
data : array[1..armax] Of Real;
End;
...
Var:
fh: File Of Tfulldata;
I want to analyse the data in the files (many MB in size) using Python if poss...
I'm trying to download a file from the web and save it locally, but I get an exception:
C# The process cannot access the file
'blah' because it is being used by
another process.
This is my code:
File.Create("data.csv"); // create the file
request = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
request.Timeout = 3000...
I have two files a.txt and b.txt (henceforth a and b).
My script iterates through a, does some operation, and potentially inserts a line to b.
In the event the script stops, I need it to pick up where it left off. In the example below:
foo was copied to b
bar was copied to b
zim was not copied to b (did not pass some criteria)
gaz wa...
Is there a good solution for picking a file in an android application? I need the user to be able to browse their SD card for a file they would like to load. However, it cannot use an outside application (like andExplorer or OI File Manager). It must stay contained inside my application and not require users to install other applications...