delphi2010 stream.writebuffer中字符串参数的问题

jieguo 2012-01-17 03:24:39
var
L: integer;
begin

L := Length(AValue);
CXlsLabel[1] := 8 + L;
CXlsLabel[2] := FRow;
CXlsLabel[3] := FCol;
CXlsLabel[5] := L;
Stream.WriteBuffer(CXlsLabel, SizeOf(CXlsLabel));

Stream.WriteBuffer( Pointer(AValue)^ , L );

if IncStatus then
IncColRow;
end;

上面这段代码,在delphi7中运行都好好的,但是到delhpi2010中输出全是乱码,谁知道怎么处理。
...全文
379 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jieguo 2012-01-17
  • 打赏
  • 举报
回复
算啦,我换种方法把
funxu 2012-01-17
  • 打赏
  • 举报
回复
这问题不是简单乘2解决的吧
2010里用ansistring
jieguo 2012-01-17
  • 打赏
  • 举报
回复
procedure TDBGridEhToExcel.WriteStringCell(const AValue: string; const IncStatus: Boolean=True);

AValue是字符串,

我这个地方L*2 也不好用啊
BambooCaep 2012-01-17
  • 打赏
  • 举报
回复
定义字符串 CXlsLabel为 ansistring
Stream.WriteBuffer(CXlsLabel[1], length(CXlsLabel));
funxu 2012-01-17
  • 打赏
  • 举报
回复
delphi7是ansi字符集字符占1字节,2010是unicode字符集,一个字符占2个字节
还有你的AValue是字符串么?Length在delphi7表字节,2010表字符

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧