473,387 Members | 3,801 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,387 software developers and data experts.

could not open the path

1
I used the following code of how to write a text file in .net..but i had an error could not open the path..how can i rectify it

extWriter tsw = new StreamWriter(@"C:\Hello.txt");

//Writing text to the file.
tsw.WriteLine("Hello");

//Close the file.
tsw.Close();

//Launch the file.
Process.Start(@"C:\Hello.txt");

please help me as soon as possible
Jan 17 '12 #1
2 1435
C CSR
144 100+
Please tell me its not the missing "T"
Jan 18 '12 #2
PsychoCoder
465 Expert Mod 256MB
First you are missing a T, next make sure the file exists before trying to open it:

Expand|Select|Wrap|Line Numbers
  1. if(File.Exist(@"C:\Hello.txt"))
  2. {
  3.     //do your stuff
  4. }
  5. else
  6. {
  7.     //throw your error
  8. }
Jan 18 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: amita | last post by:
hi, 1.I want to show a image file of type '.tif' in the browser window; for that I'm writting as ASP code page. 2.This '.tif' type image can be shown better with 'Kodak Image Control'. 3.To...
70
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
4
by: anag | last post by:
I am opening pop up windows from a hint button on several pages in my site. If the user leaves the pop up window open from a previous page, I would like the new hint to open in that window. I...
4
by: Tim | last post by:
Hello, i try to write some data into an XML-file via c#. When I specify the path like "c:\\temp\\test.xml" the XmlTextWrite could open the file. But when I tried to get the path from...
17
by: chris.atlee | last post by:
Hi there, I haven't seen this topic pop up in a while, so I thought I'd raise it again... What is the status of the path module/class PEP? Did somebody start writing one, or did it die? I...
0
by: thomas | last post by:
I found John Viescas's book "Access2003 Inside and Out" most helpful especially the section on Data Access Pages, and as such I have successfully launched a Intranet Web site whereby 4 remote sites...
1
by: Raggie | last post by:
Gentlemen, first of all I have a general question... is it possible to open an excel file directly through the ASP.NET page without to install Excel on server? I tried something on my...
3
by: jon | last post by:
I am looking for a way for a user to view the file, my program has just created, without going to look for it!! Please help aspiring programmer Jon 15
3
by: kelemen.viktor | last post by:
Hello! Im a quite newbie in the python world. I have some problem with packages, i installed the jpype package according to its intructions. To test ive written: everything worked correctly...
3
anoble1
by: anoble1 | last post by:
Hopefully I can explain this. I have a main excel sheet that when it opens it grabs data from 8 other spread sheets and updates numbers on the main one. Well, when it opens in Excel 2007 I get a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.