473,383 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Little question

Hi, to all..

I have a method that creates a Random File

And another method that open the notepad with this File

I dont know, but first of all i call to the first method.
after that i call to the second.. The program crash cause
the file exist a little time after the execution of the
second method...
Anybody could give me a hand?
Thanks in advance.
Roinem.
Nov 15 '05 #1
4 1113
Roinem <an*******@discussions.microsoft.com> wrote:
I have a method that creates a Random File

And another method that open the notepad with this File

I dont know, but first of all i call to the first method.
after that i call to the second.. The program crash cause
the file exist a little time after the execution of the
second method...
Anybody could give me a hand?


Could you post a short but complete example which demonstrates the
problem? See http://www.pobox.com/~skeet/csharp/complete.html

My guess is that you're not closing the FileStream.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
Hi...

Im using the FileInfo.Create() Method

First of all i generate a random file name and store in
one property of the class (string RandomFileName)...

And after that
i make this...

FileInfo MyFile=new FileInfo(this.RandomFileName)
MyFile.Create();

System.Diagnostics.Start
("iexplorer.exe",this.RandomFileName)
The File its empty, but should be existing...

When the program Open the internet explorer process with
the filename, this file is not already existing...

I will try use the FileStream....

Thanks Jon
Regards.
Roinem

-----Original Message-----
Roinem <an*******@discussions.microsoft.com> wrote:
I have a method that creates a Random File

And another method that open the notepad with this File

I dont know, but first of all i call to the first method. after that i call to the second.. The program crash cause the file exist a little time after the execution of the second method...
Anybody could give me a hand?
Could you post a short but complete example which

demonstrates theproblem? See http://www.pobox.com/~skeet/csharp/complete.html
My guess is that you're not closing the FileStream.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.

Nov 15 '05 #3
MyFile.Create() returns a FileStream of the created file.

Try

FileStream fs = MyFile.Create();
fs.Close();

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #4
Thanks Morten, It works..
Regards.
Roinem.
Happy new year...
-----Original Message-----
MyFile.Create() returns a FileStream of the created file.

Try

FileStream fs = MyFile.Create();
fs.Close();

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/.

Nov 15 '05 #5

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

Similar topics

8
by: Usman | last post by:
Huy everyone , Well I am not a big C++ programmer , I am just a little young kid on it tryint to learn . Actually I was given an assignment last week by my teacher which I solved ...
38
by: Martin Marcher | last post by:
Hi, I've read several questions and often the answer was 'C knows nothing about .' So if C knows that little as some people say, what are the benefits, I mean do other languages know more...
11
by: Steve | last post by:
Hi, i know this is an old question (sorry) but its a different problem, i need to write a binary file as follows 00000011 00000000 00000000 00000101 00000000 11111111
2
by: Mehta Shailendrakumar | last post by:
Hi, I am sending this question again as new question rather than reply to old question Please refer below: struct raw_data { unsigned char x; unsigned char y; }; union full_data
10
by: Tom Dacon | last post by:
I'm curious to see if anyone has an opinion on this little design question - I'm doing a computational astronomy library in C#, purely for my own use, and one of the things that happens regularly...
5
by: Amirallia | last post by:
I developped a WEB application for a customer. All is ok. Now I have made changes in the Global.asax.vb file My question is what files must I send to the customer for having this changes ?...
13
by: Kiuhnm | last post by:
How would you implement a static dictionary with macros? For example, the five lines PL_FIND(MYDICT, HOUSE) PL_FIND(MYDICT, AUTO) PL_FIND(MYDICT, THIS_IS_NOT_IN_THE_DICTIONARY)...
6
by: Javier | last post by:
Hello people, I'm recoding a library that made a few months ago, and now that I'm reading what I wrote I have some questions. My program reads black and white images from a bitmap (BMP 24bpp...
23
by: guthena | last post by:
Write a small C program to determine whether a machine's type is little-endian or big-endian.
4
by: Wouter84 | last post by:
I got little question. I want to generate auto customernumber, with Surname as startpoint. I take first two chars from surname and convert them to ascii. But my function returns the varchar as 147...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.