473,785 Members | 2,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File.OpenWrite( ...) file not found

I am writing out some files, using this syntax:

FileStream fw = File.OpenWrite( Filename);
fw.Write(bytear ray,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 3531
Ron <Ro*@discussion s.microsoft.com wrote:
I am writing out some files, using this syntax:

FileStream fw = File.OpenWrite( Filename);
fw.Write(bytear ray,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.co m>
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*@discussion s.microsoft.com wrote:
I am writing out some files, using this syntax:

FileStream fw = File.OpenWrite( Filename);
fw.Write(bytear ray,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.co m>
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*@discussion s.microsoft.com wrote:
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.co m>
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(bytear ray,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
"ModelBuild er" 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(bytear ray,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
7969
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 the assembly can be found and loaded? Thanks! Tim
4
2027
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 to call the functions from that package, I use "#include xxx.h" in my file. But the problem is that then I need to add many related .c files into my project. It makes my project file view messy. Do you know anyway to solve this problem? (so that...
1
4733
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 the "the batch file cannot be found" message .. how can I get rid of this .. while staying with the batch file method? here is my code: /*self deleting exe*/
2
8226
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 an error opening the document the file cannot be found". Here is my C# ASP.NET web code. I am running IE 6.0. Can anyone advise. ... First I create the file and then use Response object to open it. Response.ContentType="application/pdf";...
1
3499
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 cannot be found". The system also tells me that some of the components are not installed on the web server. However, I have the IIS installed and I can create a new web app and it works fine. How can I find what is missing? I hate to loose a...
19
2241
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 the problem. Can you help?
4
1219
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 page. All of the sudden the ActiveX component stopped working on the development server but still works on production. I checked the logs, and it was saying File Cannot Be Found when trying to find the .dll, but it is there. It does however work,...
5
7439
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 Integer = 0 To (ds.Tables(0).Columns.Count - 1) col = row(i).ToString.Replace(","c, " "c) 'make sure no extra commas
7
1429
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 file is not found? Do I need to use something other than Try? I tried taking the Try away and then I get errors and no file reads. Jo Ann Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ...
0
9480
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
10330
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10093
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
9952
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...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
3654
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.