MyException - 我的异常网
当前位置:我的异常网» C# » 个有关问题,多谢

个有关问题,多谢

www.MyException.Cn  网友分享于:2013-12-29  浏览:10次
弱弱的问个问题,谢谢!
FileStream.Seek(pos,   SeekOrigin.End);请问在c#中这句话是什么意思啊?也就是返回的文件流的位置是如何确定的,谢谢!

------解决方案--------------------
public static void StringToFile(string sFilePath, string sString)
{
FileStream outFile;
byte[] binaryData;
binaryData = System.Convert.FromBase64String(sString);
outFile = new FileStream(sFilePath,FileMode.Create,FileAccess.Write);
outFile.Write(binaryData, 0, binaryData.Length);
outFile.Close();
}

public static string FileToString(string sFilePath)
{
FileStream inFile;
byte[] binaryData;
inFile = new FileStream(sFilePath,FileMode.Open,FileAccess.Read);
binaryData = new Byte[inFile.Length];
long bytesRead = inFile.Read(binaryData, 0,(int)inFile.Length);
inFile.Close();
return System.Convert.ToBase64String(binaryData, 0,binaryData.Length);
}

应该能看懂得吧^0^

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有