Web
Site
Register
::
Login
Forums
February 06, 2012
Forums
Unanswered
Active Topics
Forums
Search
Forums
>
Programming - Dotnet / Delphi
>
.Net Framework Code Snippets
Subject: Save a string to a file (append or create the file)
Prev
Next
Add Reply
Author
Messages
Oldest First
Newest First
Don
New Member
Posts:20
01/30/2005 5:26 PM
Quote
Reply
private
void
SaveStringToFile(
string
afilename,
string
txt ) {
try
{
if
(File.Exists(afilename)) {
using
(StreamWriter sr = File.AppendText(afilename) ) {
sr.WriteLine(txt);
}
}
else
{
using
(StreamWriter sw = File.CreateText(afilename)) {
sw.WriteLine(txt);
}
}
}
catch
(Exception e) {
throw
(
new
Exception(
'Cannot save: '
+ afilename +
'\nError is:\n'
+ e.Message));
}
}
Add Reply
FAQ
--General FAQ
Experiences
--Comments, complaints about anything
--Customer Service
Music
--New Music Notifications
--General Music
--St. Alphonzo's 2010
--St. Alphonzo's 2009
--St. Alphonzo's 2008
--St. Alphonzo's 2007
--St. Alphonzo's 2006
--St. Alphonzo's 2005
Programming - Dotnet / Delphi
--General DotNet
--.Net Framework Code Snippets
--ASP.NET Tips and Snippets
--Compact Framework
--Compact Framework Code Snippets
--Delphi
Forums
>
Programming - Dotnet / Delphi
>
.Net Framework Code Snippets
> Save a string to a file (append or create the file)
Quick Reply
Username:
Subject:
Body:
Submit
Home
Forums
Bluto Band
Music
Music Videos
Photographs
Download
Liquid Mix
ERG 40
Favorite Links
Home
|
Forums
|
Bluto Band
|
Music
|
Music Videos
|
Photographs
|
Download
|
Liquid Mix
|
ERG 40
|
Favorite Links