thieumao

Ghi file với FileStream

Aug 31st, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. namespace DocGhiFile
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             FileStream fs = new FileStream(@"D:\CS\test\leo.txt", FileMode.Create, FileAccess.Write, FileShare.None);
  14.             StreamWriter sw = new StreamWriter(fs);
  15.             Console.WriteLine("Moi ban nhap 1 dong: ");
  16.             string str = Console.ReadLine();
  17.             sw.WriteLine(str);
  18.             sw.Flush();
  19.             sw.Close();
  20.             fs.Close();
  21.         }
  22.     }
  23. }
Add Comment
Please, Sign In to add comment