FileStream fs=new FileStream (filename, FileMode. Open, FileAccess. Read);
BinaryReader r=new BinaryReader (fs);
Untreated System. ArgumentException HResult=- 2147024809 Message=with illegal characters in Path, Source=mscorlib StackTrace: in the System. IO. Path. CheckInvalidPathChars (String Path, Boolean checkAdditional) in the System. IO. Path. The GetFileName (String Path) in the System. IO. FileStream.. ctor(String path, FileMode mode, FileAccess access) 在 推箱子2._0.Form1.ReadMap(Int32 n) 位置 C:\Users\13374\Documents\Visual Studio 2015\Projects\推箱子2.0\推箱子2.0\Form1.cs:行号 36 在 推箱子2._0.Form1.initdata() 位置 C:\Users\13374\Documents\Visual Studio 2015\Projects\推箱子2.0\推箱子2.0\Form1.cs:行号 53 在 推箱子2._0.Form1.Form1_Load(Object sender, EventArgs e) 位置 C:\Users\13374\Documents\Visual Studio 2015\Projects\推箱子2.0\推箱子2.0\Form1.cs:行号 58 在 System.Windows.Forms.Form.OnLoad(EventArgs e) 在 System.Windows.Forms.Form.OnCreateControl() 在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) 在 System.Windows.Forms.Control.CreateControl() 在 System.Windows.Forms.Control.WmShowWindow(Message& M) in the System. Windows. Forms. Control. WndProc (Message& M) in the System. Windows. Forms. ScrollableControl. WndProc (Message& M) in the System. Windows. Forms. Form. WmShowWindow (Message& M) in the System. Windows. Forms. Form. WndProc (Message& M) in the System. Windows. Forms. Control. ControlNativeWindow. OnMessage (Message& M) in the System. Windows. Forms. Control. ControlNativeWindow. WndProc (Message& M) in the System. Windows. Forms. NativeWindow. DebuggableCallback (IntPtr hWnd, Int32 MSG, IntPtr wparam, IntPtr lparam) InnerException:
CodePudding user response:
The second line:Box 2.0 \ bin \ \ Debug \ \ Map
Should be changed to:
2.0 box \ \ bin \ \ Debug \ \ Map
CodePudding user response:
String concatenation recommended or use string format.CodePudding user response:
This problem should be the path you are directly copied to appearing in the code..I also met a lot of time.. Very simple d: \ \ 1. TXT if manual to knock up it is no problem.
If from the resource manager or the path of the file itself copied the past suggests that there was a problem..
May is the coding system.
But this code in fact you should not be written as a fixed directory should use the
Var data=https://bbs.csdn.net/topics/file.readallbytes (System. Windows. Forms. Application. StartupPath + "\ \ Map \ " + I + "info");
To implement the
CodePudding user response:
Your ide has told you, it is a great god: path withYou put the into English, then 2.0 this take out,
CodePudding user response: