I want to use it to a file is written to, but in the second parameter StreaWriter appeared error, is like this: Severity code shows the project file line prohibits display status Error CS1503 parameter 2: from "bool" into "System. Text. Encoding" Game2048 F: \ \ c # learning through four extension code \ \ control experiment Game2048 \ Game2048 \ Form1 cs 201 activity
Want to ask that how to solve the
CodePudding user response:
There is something wrong with the code below is my baidu search, go to the baidu search, don't have a question to ask, learn to think more, rather than ask someone else to answer
//c # file stream to write the file, the default add FileMode. Append String MSG="okffffffffffffffff"; Byte [] myByte=System. Text.. Encoding UTF8. GetBytes (MSG); Using (FileStream fsWrite=new FileStream (@ "D: \ 1. TXT", FileMode, Append)) { FsWrite. Write (myByte, 0, myByte. Length); }; //c # file stream to read the file Using (FileStream fsRead=new FileStream (@ "D: \ 1. TXT", FileMode. Open)) { Int fsLen=(int) fsRead. Length; Byte [] heByte=new byte [fsLen]; Int r=fsRead. Read (heByte, 0, heByte. Length); . String myStr=System. Text. Encoding UTF8. Get string (heByte); Console. WriteLine (myStr); The Console. ReadKey (); }
CodePudding user response:
Elder brother,,, I have tried on baidu things... Is because did not find useful, just to ask the