Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems opening a file.....?

0 views
Skip to first unread message

David Law

unread,
Jul 24, 2009, 7:53:48 AM7/24/09
to
Hi

I have been playing around with Visual c# and I'm trying to work out
whether its me or c# (I'm from a c background btw). Have created a
simple little program to read the contents of a file in ....
Now I have found something rather strange (the files do exist in these
locations) if I use this line in the code stub below ...

FileStream filePTR = new FileStream("C:\\findme.txt",
FileMode.Open, FileAccess.Read);

It works...

Yet If I use this line

FileStream filePTR = new FileStream("C:\\Dr1\\Dr2\\findme.txt",
FileMode.Open, FileAccess.Read);

it doesn't. So am I wondering is it me or am I missing something
fundermental?. Thanks in advance for time and consideration, btw does
c# have a sleep command?or do you just use the
for( int i = 1; i ,= 1000000 ; i++ ){}.

Thanks in advance for your time on this question.

Le Tubs

string line;
//Pass the file path and file name to the FileStream
constructor
** FileStream filePTR = new FileStream("C:\\Dr1\
\findme.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(filePTR);
//Read the first line of text
line = sr.ReadLine();
Console.WriteLine(" ... {0} ", line);
sr.Close();

David Law

unread,
Jul 24, 2009, 8:01:51 AM7/24/09
to
On 24 July, 12:53, David Law <dlaw...@googlemail.com> wrote:

**** PLease Ignore Posted to wrong group..... sorry! ****

0 new messages