您的位置:程序门 -> vb ->



vb中的chr函数与delphi中的chr函数返回的结果一样吗?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vb中的chr函数与delphi中的chr函数返回的结果一样吗?
发表于:2007-10-18 18:50:29 楼主
有以下一样delphi的代码:
var
            ary_byt1:   array   [0..51200]   of   byte;
            int_bufsize,int_i:integer;
            str_out:string;
            f_iofile:textfile;
begin
        int_bufsize:=getfonthex('保税',   '宋体',   0,   150,   20,   20,   0,ary_byt1);     //汉字存入ary_byt1缓存中   ,黑体,旋转角度0,字体5mm,x座标20,y座标20,字形0
        for   int_i:=0   to   int_bufsize-1   do
        begin
                  str_out:=str_out+chr(ary_byt1[int_i]);                                               //ary_byt1l转换为字符串
        end;
        assignfile(f_iofile,'c:\test.txt');                               //定义端口
        //assignfile(f_iofile,'lpt1');                               //定义端口
        rewrite(f_iofile);
        writeln(f_iofile,str_out);                                 //写(dll示例)到缓存
        closefile(f_iofile);

我在vb中的代码:
        dim   cbuf(51200)   as   byte
        dim   str   as   string
        dim   z   as   integer
        ncount   =   getfonthex("保税",   "宋体",   0,   150,   20,   20,   0,   cbuf(ncount))
        for   z   =   0   to   ncount   -   1
                str   =   str   &   chr(cbuf(z))
        next   z


为什么vb中的str变量与delphi中的str_out变量得到的结果不相同呢?
请各位高手指点一下,谢谢!


发表于:2007-10-18 19:32:041楼 得分:0
差在哪里?
发表于:2007-10-19 10:59:272楼 得分:0
更具   cbuf   中的内容为   unicode   或   ansi,分别调用下述两种方式之一取得字符串
str   =   cbuf   'unicode
str   =   strconv(cbuf,   vbunicode)   'ansi   ->   unicode


快速检索

最新资讯
热门点击