File.OpenWrite(...) file not found

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
Ron said:
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.
 
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.
 
Ron said:
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.
 
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.
 
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
 
Back
Top