帮忙,请教一个问题! inc(foundstr,length(foundstr));foundstr在执行这条语句之前为"want to" 在执行之后就是"",这是为什么?inc()对它进行了什么操作?inc()不是对参数进行加值的操作吗! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 foundstr must be a variable of an ordinal type 不能是string 同志们那是一条正确的语句.完成的程序如下: retval:=findfirst(dlbdirectories.directory + '\*.txt',faAnyFile,searchrec); try while retval=0 do begin fname:=searchrec.Name; memmapfile:=tmemmapfile.create(fname,fmopenread,0,true); try findstring:=edtsearchstring.text; wordcount:=0; foundstr:=strpos(pchar(memmapfile.data),pchar(findstring)); if foundstr<>nil then begin repeat inc(wordcount); showmessage('start foundstr:' + foundstr); inc(foundstr,length(foundstr)); showmessage('end foundstr:' + foundstr); foundstr:=strpos(pchar(foundstr),pchar(findstring)); until foundstr=nil; lbfilesfound.items.add(searchrec.name+' . '+inttostrwordcount)); end; retval:=findnext(searchrec); 菜鸟求救!clientdataset中怎么实现类似数据库中distinct的效果? 在DELPHI中能不能构造一个 虚拟 的数据集? 用shellexecute执行一外部程序,如何等外部程序执行完再执行下一条语句? ******醒目散分贴****** TEDIT怎么样才能得到焦点而又不会被全选? 請問一下tqrdbrichtext的用法 ADO 事务问题,江湖救急!!! 我是初学者,大家帮帮我! Char类型的一个问题补充(嘿嘿嘿!不耻下问): 这是为什么!---关于TQuery, Update, Sql 超长SQL语句,高手进来看,在线等待 超长SQL语句,高手进来看,在线等待
不能是string
try
while retval=0 do
begin
fname:=searchrec.Name;
memmapfile:=tmemmapfile.create(fname,fmopenread,0,true);
try
findstring:=edtsearchstring.text;
wordcount:=0;
foundstr:=strpos(pchar(memmapfile.data),pchar(findstring));
if foundstr<>nil then
begin
repeat
inc(wordcount);
showmessage('start foundstr:' + foundstr);
inc(foundstr,length(foundstr));
showmessage('end foundstr:' + foundstr);
foundstr:=strpos(pchar(foundstr),pchar(findstring));
until foundstr=nil;
lbfilesfound.items.add(searchrec.name+' . '+inttostrwordcount));
end;
retval:=findnext(searchrec);