Is it possible for this combination of lines to create a 0 byte file? I would expect the write to always complete. Thanks!
File.WriteAllBytes(file_name, encrypted_data);
encrypted_data = null;
Edit: assuming my byte array isn't empty of course, which I am adding checks for.
try to user writeByte instead of File.WriteAllBytes
FileStream stream = File.Open(FilePath,FileMode.OpenOrCreate);
if (null != stream)
{
byte[] encrypted_data=something; // your bytes
foreach (byte b in encrypted_data)
{
stream.WriteByte(b);
}
}
stream.Close();
you can still use System.IO.File.ReadAllBytes when you read file
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다