CnPack Forum


 
Subject: 如何返回Pchar类型的0
wfymqj
灌水科科长
Rank: 3Rank: 3



UID 1023
Digest Posts 0
Credits 178
Posts 70
点点分 178
Reading Access 10
Registered 2005-9-6
Location 湖北
Status Offline
Post at 2007-7-27 17:40  Profile | Blog | P.M. 
如何返回Pchar类型的0

有一个函数的返回值为Pchar类型,‘0’表示成功,请问如何返回啊

我用StrPcopy(Result,0)的方式工 Result:=0的方式返回均不行
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2007-7-27 23:35  Profile | Blog | P.M. 
Result := '0';
行不?
Top
wfymqj
灌水科科长
Rank: 3Rank: 3



UID 1023
Digest Posts 0
Credits 178
Posts 70
点点分 178
Reading Access 10
Registered 2005-9-6
Location 湖北
Status Offline
Post at 2007-7-28 08:14  Profile | Blog | P.M. 
这个我也试了的,忘写上去了

上面的几项返回方法,在调试时可以看到 Result 的值为nil
Top
wfymqj
灌水科科长
Rank: 3Rank: 3



UID 1023
Digest Posts 0
Credits 178
Posts 70
点点分 178
Reading Access 10
Registered 2005-9-6
Location 湖北
Status Offline
Post at 2007-7-28 13:29  Profile | Blog | P.M. 
知道了,Result := chr($30);
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2007-7-28 21:56  Profile | Blog | P.M. 
楼上是返回Char了吧?
Top
kendling (小冬)
高级版主
Rank: 8Rank: 8
MyvNet


Medal No.1  
UID 703
Digest Posts 5
Credits 978
Posts 580
点点分 978
Reading Access 101
Registered 2005-2-18
Location 广东
Status Offline
Post at 2007-7-30 08:54  Profile | Site | Blog | P.M.  | QQ | Yahoo!
Result := '0'#0;呢?




小冬
http://MyvNet.com
Top
shenloqi
灌水处处长
Rank: 4



UID 34
Digest Posts 1
Credits 287
Posts 179
点点分 287
Reading Access 10
Registered 2003-3-15
Status Offline
Post at 2007-7-30 10:13  Profile | P.M. 
如果需要返回一个可以修改的PChar,你需要用Result := StrNew('0'),然后在使用完返回值之后使用StrDispose释放掉
Top
wfymqj
灌水科科长
Rank: 3Rank: 3



UID 1023
Digest Posts 0
Credits 178
Posts 70
点点分 178
Reading Access 10
Registered 2005-9-6
Location 湖北
Status Offline
Post at 2007-7-31 14:09  Profile | Blog | P.M. 
是别人的程序提供的一个接口函数,返回值为Pchar
我在动态链接库 使用 Result := chr($30); 对方的程序就不产生异常,并且结果也正确了
因为是接口函数的返回值,所有应该不需要我来使用StrNew吧

Result := '0'#0还未试,有时间再试试

谢谢各位提供方法
Top
stanleyxu2005
新警察
Rank: 1



UID 5617
Digest Posts 1
Credits 45
Posts 15
点点分 45
Reading Access 10
Registered 2007-2-11
Status Offline
Post at 2007-7-31 17:11  Profile | Site | Blog | P.M. 
强制把pchar转成int然后再转回pchar试试看




http://getgosurf.com/forum/
Top
 




All times are GMT++8, the time now is 2024-11-23 10:28

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.010015 second(s), 9 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP