473,326 Members | 2,173 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,326 software developers and data experts.

File.OpenWrite(...) file not found

I am writing out some files, using this syntax:

FileStream fw = File.OpenWrite(Filename);
fw.Write(bytearray,0,amount);
fw.Close();

The files appear in Windows Explorer, they show up from the DOS Cmd when I
do a wild card dir, but they cannot be copied in the DOS Cmd box. I get "file
not found". Am I missing a step; not doing something? This is .NET 1.1.
Jun 26 '07 #1
5 3502
Ron <Ro*@discussions.microsoft.comwrote:
I am writing out some files, using this syntax:

FileStream fw = File.OpenWrite(Filename);
fw.Write(bytearray,0,amount);
fw.Close();

The files appear in Windows Explorer, they show up from the DOS Cmd when I
do a wild card dir, but they cannot be copied in the DOS Cmd box. I get "file
not found". Am I missing a step; not doing something? This is .NET 1.1.
It would help if you gave us a step-by-step example of what's going
wrong, including what operating system you're using and what the
filename is.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jun 26 '07 #2
Sure. The OS is XP Pro SP2. I did some experimentation and found that if the
filename has an extension, there is no problem. If the file name has no
extesion, this problem occurs. It doesn't matter what the file name is
otherwise.

"Jon Skeet [C# MVP]" wrote:
Ron <Ro*@discussions.microsoft.comwrote:
I am writing out some files, using this syntax:

FileStream fw = File.OpenWrite(Filename);
fw.Write(bytearray,0,amount);
fw.Close();

The files appear in Windows Explorer, they show up from the DOS Cmd when I
do a wild card dir, but they cannot be copied in the DOS Cmd box. I get "file
not found". Am I missing a step; not doing something? This is .NET 1.1.

It would help if you gave us a step-by-step example of what's going
wrong, including what operating system you're using and what the
filename is.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jun 26 '07 #3
Ron <Ro*@discussions.microsoft.comwrote:
Sure. The OS is XP Pro SP2. I did some experimentation and found that if the
filename has an extension, there is no problem. If the file name has no
extesion, this problem occurs. It doesn't matter what the file name is
otherwise.
And how were you trying to copy the file? It should be fine either way.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jun 26 '07 #4
Put double quotes arround the filename at the dos copy command. If there is
a space in the file name, the command would give an error as follows:

c:\copy pod values.xls c:\public
The system cannot find the file specified

c:\copy "pod values.xls" c:\public
1 file(s) copied.
"Ron" wrote:
I am writing out some files, using this syntax:

FileStream fw = File.OpenWrite(Filename);
fw.Write(bytearray,0,amount);
fw.Close();

The files appear in Windows Explorer, they show up from the DOS Cmd when I
do a wild card dir, but they cannot be copied in the DOS Cmd box. I get "file
not found". Am I missing a step; not doing something? This is .NET 1.1.
Jun 26 '07 #5
I've tried double quotes. No go. The files are all legal ascii chars. I've
even tried assuming that there was an invisible trailing space, again, no go.

BUT NOW, I just tried it again and no problem!!! I'm sure it is due to me;
can't figure out how or why.

Thanks anyway to all for trying to help.

RON
"ModelBuilder" wrote:
Put double quotes arround the filename at the dos copy command. If there is
a space in the file name, the command would give an error as follows:

c:\copy pod values.xls c:\public
The system cannot find the file specified

c:\copy "pod values.xls" c:\public
1 file(s) copied.
"Ron" wrote:
I am writing out some files, using this syntax:

FileStream fw = File.OpenWrite(Filename);
fw.Write(bytearray,0,amount);
fw.Close();

The files appear in Windows Explorer, they show up from the DOS Cmd when I
do a wild card dir, but they cannot be copied in the DOS Cmd box. I get "file
not found". Am I missing a step; not doing something? This is .NET 1.1.
Jun 26 '07 #6

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

Similar topics

0
by: Timothy M Hodgson | last post by:
In the Assembly Load Trace, the error: Publisher policy file is not found comes up. Is this a problem with locating the assembly? Is a publisher policy file required or even necessary as long as...
4
by: Jinjun Xu | last post by:
Hi, I am programming with VC++ (6) in windows. I am using LASPACK (anyone used it before?), which is a linear equation solvers package containing many head files and source files. When I want...
1
by: code_wrong | last post by:
Hi, I'm reading this: http://www.catch22.net/tuts/selfdel.asp (Self Deleting Executables) and playing around with the batch file method .. trouble is I always get a command box at the end with...
2
by: Tom | last post by:
Anytime someone wants to open a document, they have to first save it to disk. They cannot simply choose "open". If a user attempts to open the document, they are met with the error message "there was...
1
by: David | last post by:
I am working on a small web app. I attempted to copy it to the remote server via. the project/copy command and when I closed the project and attempted to reopen it, I get the error "project file...
19
by: **Developer** | last post by:
When I get the image from the file the file remains locked so the Delete fails with a "used by another process" So I tried using a clone and disposing the obtained image. But that didn't fix...
4
by: NullQwerty | last post by:
I've got some strange activity occuring. We have a development server which mirrors our production server. I have an Active-X .Net dll that sits in a Web Site Folder and is used by an aspx...
5
by: Harry Strybos | last post by:
I am confused about which is the better (or safer ) way to write files in VB.Net. Using sw As StreamWriter = New StreamWriter(fName) For Each row As DataRow In ds.Tables(0).Rows For i As...
7
by: pooker75 | last post by:
This code works perfectly except when I start I get a message that file is not found. The file is there and everything reads perfectly. How can I get the file to read and not get the message that the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.