I'm making an encryption program and need to save the encrypted password to a file using the binary reader and writer. When i try and read the data out all I get is a number. What did I do 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 the writer
public static void writeData(string fileName, string data)
{
using (BinaryWriter writer = new BinaryWriter(File.Open (fileName, FileMode.Create)))
{
writer.Write(data);
}
}