473,789 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Read error (stream)

Hello,I am trying to read from a zip stream and one of the files is of a
0 size (0 bytes)- Exception is thrown as a result but there are some
other files after it in a stream which I want to keep reading and
writing to temp dir. How can I deal such exception.

I get error when in the end I want to erase the temp dir and it won't
let me because the 0 bytes file is being used by other process.
How to solve it?
Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '06 #1
4 2481
Hi
I think you missed to close the stream object if exception occurs.

Regards
Rahul.
csharpula csharp wrote:
Hello,I am trying to read from a zip stream and one of the files is of a
0 size (0 bytes)- Exception is thrown as a result but there are some
other files after it in a stream which I want to keep reading and
writing to temp dir. How can I deal such exception.

I get error when in the end I want to erase the temp dir and it won't
let me because the 0 bytes file is being used by other process.
How to solve it?
Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '06 #2
In the catch part I did :

streamWriter.Cl ose();
zipInputStream. CloseEntry()

but it's not helping and when I am trying to erase the temp dir,the 0
bytes file is been holden by some other proces.
How could it be?
Thanks!
*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '06 #3
Why is there an exception just because the file size is zero? What
object is throwing the exception?

If possible, try to handle the zero size files without using exceptions.

csharpula csharp wrote:
In the catch part I did :

streamWriter.Cl ose();
zipInputStream. CloseEntry()

but it's not helping and when I am trying to erase the temp dir,the 0
bytes file is been holden by some other proces.
How could it be?
Thanks!
*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '06 #4
Not sure if you want it in catch maybe in a finally.

But try to find the filesize before committing it to a stream is probably
the best option.

"Göran Andersson" <gu***@guffa.co mwrote in message
news:uD******** ******@TK2MSFTN GP05.phx.gbl...
Why is there an exception just because the file size is zero? What object
is throwing the exception?

If possible, try to handle the zero size files without using exceptions.

csharpula csharp wrote:
>In the catch part I did :

streamWriter.Cl ose();
zipInputStream .CloseEntry()

but it's not helping and when I am trying to erase the temp dir,the 0
bytes file is been holden by some other proces.
How could it be?
Thanks!
*** Sent via Developersdex http://www.developersdex.com ***

Jul 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2049
by: MyHaz | last post by:
I playing around with streaming shoutcast mp3s. Here is some sample code: ----------------------- import httplib ############ # Put together the headers headers = {"Icy-MetaData":"1"}
4
4438
by: Mike Dole | last post by:
I'm working on a client - server application based on the 'How to Sockets Server and How to Sockets Client' code from the Visual Basic ..NET Resource Kit. Since I want to be able to send 'big strings' instead of 'one liners' I check the streams for terminators. I'm having problems with the connection, I've been looking and debugging for 2 weeks now (debugging with an emulator is terribly slow..) but I'm not getting it...
6
7359
by: Yechezkal Gutfreund | last post by:
I have been using the following code (successfully) to read Xml formated text packets from a TCP stream. The output from the server stream consists of a sequence of well formed Xml documents written to the output stream. We are willing to pay $ to any expert (e.g. MVP) consultant who has to time to help us track down this problem. (we will discuss rates if you can prove your expertise, and problem solving approach).
3
2756
by: Bill Cohagan | last post by:
I'm writing a console app in c# and am encountering a strange problem. I'm trying to use redirection of the standard input stream to read input from a (xml) file. The following code snippet is from this app: =============================== static void Main(string args) { if (args.Length > 0) Console.SetIn(new StreamReader(args)); //executes if I don't use the "<", ">" redirection syntax when invoking XmlTextReader xmlin = new...
2
4070
by: GB | last post by:
Hi Everybody! I have 2 different processes/application. One is writing to a file and another is reading from it. For some reason the code doesnt seems to work and gives mscorlib.dll IOException error "This file is being used by another process". Both the applications are in C#. P.S. Even if I try to open the file with NotePad (while my server is writing data in the file)it gives the same error.
0
1418
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. My program is to connect to a remote IPAddress. Once, it verifies the login information it should display the SessionID and enable some button . I appreciate your help and thanku in advance When I run the pgm , I get the error: Can't parse login information. Object Reference not set to an instance of an object. I have added the Try-catch in all my functions. In ParseLoginResponse function, it catches the above...
1
4032
by: Terrance | last post by:
I'm trying to create a small messenger program that uses the tcpclient and tcplistenter objects. When I start the application and run the thread that fires the tcplistener; once the client sends data then closes the stream and the connection I receive the message Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. How can I keep the connection listener listening for new traffic?...
7
5703
by: capnwhit | last post by:
Hello all, The program below has a bug... The program is supposed to convert a string to a continuous hex dump and back to a string. The output should be as follows: abcd 61626364 abcd
0
2889
by: vishnu | last post by:
Hi, Am trying to post the data over https and am getting error in httpwebresponse.getResponseStream.Please help me to get rid of this issue. Here is the message from immediate window ?myResp.GetResponseStream() {System.Net.ConnectStream}
63
3268
by: Bill Cunningham | last post by:
I don't think I can do this without some help or hints. Here is the code I have. #include <stdio.h> #include <stdlib.h> double input(double input) { int count=0,div=0; double mean=0,linput=0; FILE *fpr, *fpw;
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.