creat file ?????
good evening everybody
can u me form which let me
creat empty( wordfile or pdf file or txt file) , named , save in hard disc want
thx help
link posted above... (this is for simple text file) using system; using system.io; using system.text; class test { public static void main() { string path = @"c:\temp\mytest.txt"; try { // delete file if exists. if (file.exists(path)) { // note no lock put on the // file , possibility exists // process do // between // calls exists , delete. file.delete(path); } // create file. using (filestream fs = file.create(path)) { byte[] info = new utf8encoding(true).getbytes("this text in file."); // add information file. fs.write(info, 0, info.length); } // open stream , read back. using (streamreader sr = file.opentext(path)) { string s = ""; while ((s = sr.readline()) != null) { console.writeline(s); } } } catch (exception ex) { console.writeline(ex.tostring()); } } }
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment