Ajax
ASP
C,C++
C#,.NET
CSS,HTML
Delphi,Kylix
Experience
Flash
Java
JavaScript
PHP
Python
QT
SQL
ShellScript
VB
U :
P :
Register
Lost Password
Other Links
Code Archive
Save Giovanni
C#,.NET Category Code
Real Name
:
SharingCode.NET User
Subject
:
write to a file
Description
:
write to a file
/* C#: The Complete Reference by Herbert Schildt Publisher: Osborne/McGraw-Hill (March 8, 2002) ISBN: 0072134852 */ // Write to a file. using System; using System.IO; public class WriteToFile { public static void Main(string[] args) { FileStream fout; // open output file try { fout = new FileStream("test.txt", FileMode.Create); } catch(IOException exc) { Console.WriteLine(exc.Message + "\nError Opening Output File"); return; } // Write the alphabet to the file. try { for(char c = 'A'; c <= 'Z'; c++) fout.WriteByte((byte) c); } catch(IOException exc) { Console.WriteLine(exc.Message + "File Error"); } fout.Close(); } }
Rating
:
0.00
(out of 5)
Visitor Voting Booth
:
Excellent
Very Good
Good
Fair
Poor
Copyright © 2006 SharingCode.NET . All rights reserved. Hosted By: SisNetworks