流读写方法

来源:互联网 发布:sentinel 2数据 编辑:程序博客网 时间:2024/06/14 23:35

从流读入到整型中:

    fs.Position := 0;
    fs.Read(L, lenOfInteger);

 

读入到字符串中:

    SetLength(strBuffer, L);
    fs.Read(strBuffer[1], L);

 

从流读入到数组中?

 

Move到整型:

P: PChar;

P := Pointer(strBuffer);

Move(P^, intValue, lenOfInteger);
Inc(P, lenOfInteger);

 

Move到字符串:

//这里的P和上面的那个一样

Move(P^, strValue[1], lenOfStrValue);
Inc(P, lenOfStrValue);

 

把字符串写入到流中:

fs.Write(strBuffer[1], iBufferLen);

 

把整型写入到流中:

fs.Write(listFlag, SizeOf(Integer));

 

把数组写入到流中?