Lost Password?


  #11 (permalink)  
Old 07-28-2008, 02:33 PM
Keuvie Keuvie is offline
Newbie
 
Join Date: Jul 2008
Posts: 13
Rep Power: 0
Keuvie is on a distinguished road
Default Re: C# Tutorial: Writing Text Files

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 07-28-2008, 02:42 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,589
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: C# Tutorial: Writing Text Files

You're welcome, I'm here to help.
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 08-17-2008, 04:53 PM
PlayaSkater's Avatar   
PlayaSkater PlayaSkater is offline
Learning Programmer
 
Join Date: Aug 2007
Location: Cruzer, US
Age: 17
Posts: 63
Rep Power: 5
PlayaSkater is on a distinguished road
Default Re: C# Tutorial: Writing Text Files

Thanks for the tutorial, Xav. I haven't gotten too much into file interaction with C# and this got me interested. By the way, would this be an appropriate method for storing passwords of some sort? Like if you were making a login program, it would simply read for the Username and corresponding password?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 08-17-2008, 04:59 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,589
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: C# Tutorial: Writing Text Files

You could certainly do that, although if you have lots of users then a database or XML would be better. Whatever you use, remember to encrypt the file containing the data, for security.

And you're welcome.
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 08-24-2008, 08:14 PM
amrosama's Avatar   
amrosama amrosama is offline
Guru
 
Join Date: Aug 2007
Location: egypt
Age: 20
Posts: 2,021
Last Blog:
OO Life
Rep Power: 21
amrosama is a jewel in the roughamrosama is a jewel in the roughamrosama is a jewel in the roughamrosama is a jewel in the rough
Send a message via MSN to amrosama
Default Re: C# Tutorial: Writing Text Files

hi xav, im glad u brought the System.IO class cuz it reminded me with a little coding problem that i didnt find a reason or solution for it heres the code:
Code:
 System.IO.FileInfo MyFile = new System.IO.FileInfo("newfile.txt");
 MyFile.Create();
and any statement that uses the same files gives an "file still opened by another process" exception.
and i didnt find any ".close()" method ..
__________________
A good programmer is someone who always looks both ways before crossing a one-way street
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #16 (permalink)  
Old 08-25-2008, 01:50 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,589
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: C# Tutorial: Writing Text Files

I've never actually used a FileInfo object. How about:
csharp Code:
  1. //Create a new file called newfile.txt.
  2. System.IO.File.Create("newfile.txt");
Notice how no variables are necessary, as File.Create() is static.
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 08-25-2008, 01:57 PM
amrosama's Avatar   
amrosama amrosama is offline
Guru
 
Join Date: Aug 2007
Location: egypt
Age: 20
Posts: 2,021
Last Blog:
OO Life
Rep Power: 21
amrosama is a jewel in the roughamrosama is a jewel in the roughamrosama is a jewel in the roughamrosama is a jewel in the rough
Send a message via MSN to amrosama
Default Re: C# Tutorial: Writing Text Files

still, i have the same problem when i try to access the same file like this
Code:
  System.IO.File.Create("newfile.txt");
  System.IO.File.ReadAllText("newfile.txt");
it gives the same exception on line 2
__________________
A good programmer is someone who always looks both ways before crossing a one-way street
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 08-25-2008, 02:12 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,589
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: C# Tutorial: Writing Text Files

Eh? How are you going to read the text from a file if you've just created it? It's going to be blank!
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 08-25-2008, 02:19 PM
amrosama's Avatar   
amrosama amrosama is offline
Guru
 
Join Date: Aug 2007
Location: egypt
Age: 20
Posts: 2,021
Last Blog:
OO Life
Rep Power: 21
amrosama is a jewel in the roughamrosama is a jewel in the roughamrosama is a jewel in the roughamrosama is a jewel in the rough
Send a message via MSN to amrosama
Default Re: C# Tutorial: Writing Text Files

still, it returns "being used by another process" exception....but never mind
i found an alternate by using a stream writer
Code:
  System.IO.StreamWriter create = new System.IO.StreamWriter("newfile.txt");
  create.Close();
__________________
A good programmer is someone who always looks both ways before crossing a one-way street
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 08-25-2008, 02:28 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,589
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: C# Tutorial: Writing Text Files

That's the same method I used in my tutorial!
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply

Tags
file, text, tutorial, writing



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Storing Images in MySQL with PHP Jordan PHP Tutorials 13 09-23-2008 07:11 PM
Text files travy92 Visual Basic Programming 1 10-07-2007 11:06 AM
How to style fonts of a text in a simple page? c0de Tutorials 3 09-15-2007 11:08 PM
HTML Basic Formatting clookid Tutorials 14 03-06-2007 04:10 PM
John's Java Tutorial Index John Java Tutorials 0 01-11-2007 04:05 PM


All times are GMT -5. The time now is 11:35 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads