0
일부 C++ 코드를 C#으로 변환하는 중입니다. C# 코드를 작성하여 C# 응용 프로그램에서 작성하고 동일한 작업을 수행하는 방법을 파악하려고합니다.C#과 같은 fread
fread(&Start, 1, 4, ReadMunge); //Read File position
나는 그런하여 FileStream을 사용하는 등 여러 가지 방법을 시도 :
using (FileStream fs = File.OpenRead("File-0027.AFS"))
{
//Read amount of files from offset 4
fs.Seek(4, SeekOrigin.Begin);
FileAmount = fs.ReadByte();
string strNumber = Convert.ToString(FileAmount);
fileamountStatus.Text = strNumber;
//Seek to beginning of LBA table
fs.Seek(8, SeekOrigin.Begin);
CurrentOffset = fs.Position;
int numBytesRead = 0;
while (Loop < FileAmount) //We want this to loop till it reachs our FileAmount number
{
Loop = Loop + 1;
//fread(&Start, 1, 4, ReadMunge); //Read File position
//Start = fs.ReadByte();
//Size = fs.ReadByte();
CurrentOffset = fs.Position;
int CurrentOffsetINT = unchecked((int)CurrentOffset);
//Start = fs.Read(bytes,0, 4);
Start = fs.Read(bytes, CurrentOffsetINT, 4);
Size = fs.Read(bytes, CurrentOffsetINT, 4);
Start = fs.ReadByte();
}
}
내가으로 실행 계속 문제가 Start/Size
내가 필요한 데이터의 4 바이트를 보유하지 않는다는 것입니다.