I have a problem and need help...
I tried read library file (aaa.lib) with my code.
But I got error when one of files was read.
My code read any other files, so code is no problem.
But I could read it with another C++ code .....;;;$%#
That is why I could not solve this problem..
Detail symtom is that...
From 433th data is totally different with real lib data.
If I change something after 433th data, nothing works.
If I deleted datas 0 ~ 433th in aaa.lib, I got error at another part.
Is there any.. .NET framework problem...???
If you have similar problem, please give me advice...
FileStream strReadFile = new FileStream(_path + "\\aaa.lib", FileMode.Open);
BinaryReader bReadFile = new BinaryReader(strReadFile);
int i = 0;
int nCnt, nNum;
do
{
tmpData_Table.data_no[i] = ByteSwap(bReadFile.ReadUInt32());
tmpData_Table.data_type[i] = ByteSwap(bReadFile.ReadUInt32());
tmpData_Table.stuff_type[i] = ByteSwap(bReadFile.ReadUInt32());
....
} while (++i < (strReadFile.Length / 516));
and this is code for Byte Order
public uint ByteSwap(uint i_nChangeByteOrder)
{
uint nCounterByte = 0x0;
uint nReturnValue = 0x0;
for (int nShift = 31; nShift >= 0; --nShift)
nCounterByte |= (((i_nChangeByteOrder >> nShift) & 0x1) << (31 - nShift));
nCounterByte = ((nCounterByte & 0x0F0F0F0F) << 4) | ((nCounterByte & 0xF0F0F0F0) >> 4);
for (int nShift = 24; nShift >= 0; nShift -= 8)
nReturnValue |= (ChangeByteSwap((nCounterByte >> nShift) & 0xFF) << nShift);
return nReturnValue;
}
public uint ChangeByteSwap(uint i_cChangeOneByte)
{
uint nLowByte = 0x0;
uint nHighByte = 0x0;
for (int nShift = 3; nShift >= 0; --nShift)
nLowByte |= (((i_cChangeOneByte >> nShift) & 0x1) << (3 - nShift));
for (int nShift = 7; nShift >= 4; --nShift)
nHighByte |= (((i_cChangeOneByte >> nShift) & 0x1) << (7 - nShift));
return ((nHighByte << 4) | nLowByte) & 0xFF;
}
This post has been edited by nedoryuk: 05 April 2009 - 06:10 AM

Start a new topic
Add Reply





MultiQuote
| 


