joe_pool_is
Well-known member
I used to append a file using Classic ASP on my website.
I finally migrated parts over to .NET, but I cant seem to find out how to append a file. I can still determine if the file exists using File.Exists, but I dont know how to fill it!
I finally migrated parts over to .NET, but I cant seem to find out how to append a file. I can still determine if the file exists using File.Exists, but I dont know how to fill it!
C#:
if (File.Exists(strPath) == true) {
FileStream fs = null;
try {
fs = File.Open(strPath, FileMode.Append);
char[] data = historyMsg.ToCharArray();
byte[] bdat = new byte[2 * data.Length];
for (int i = 0; i < (2 * data.Length); i++) {
// how do I fill this part???
}
fs.Write(bdat, 0, bdat.Length);
} catch (Exception err) {
Response.Write("<b>Unable to append to log file: <font color=\"red\">" + err.Message + "</font></b><br/><br/>");
ok = false;
} finally {
if (fs != null) {
fs.Close();
}
}