binaryreader - C# Binary Reader -
i'm making encryption program , need save encrypted password file using binary reader , writer. when try , read data out number. did wrong?
public static string readdata(string filename) { string data; filestream fstream = new filestream(filename, filemode.open, fileaccess.read); using (binaryreader reader = new binaryreader(fstream)) { data = reader.read().tostring(); } return data; }
and writer
public static void writedata(string filename, string data) { using (binarywriter writer = new binarywriter(file.open (filename, filemode.create))) { writer.write(data); } }
use reader.readstring()
instead.
data = reader.readstring();
the read method reads next character , returns corresponding integer value of can see in documentation.basically, have written string
file in binary format, need read back.
Comments
Post a Comment