Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.pascal.delphi.misc > #373

Re: xpost (Sorry) Can someone show me the fix for this please?

From Marco van de Voort <marcov@toad.stack.nl>
Newsgroups comp.lang.pascal.delphi.misc
Subject Re: xpost (Sorry) Can someone show me the fix for this please?
Date 2012-07-19 19:45 +0000
Organization Stack Usenet News Service
Message-ID <slrnk0gou1.99o.marcov@toad.stack.nl> (permalink)
References <c0df65a9-11ec-4a22-accc-cb05042612ce@googlegroups.com>

Show all headers | View raw


On 2012-07-19, bok <bok.globule@gmail.com> wrote:
>
> The line below of "S:=Reversestring(S)" causes a file full of "nul" to be written instead of S. How do I manipulate S and then correctly write the altered 
> string to n2.exe. 

An empty string might be NIL. Dereferencing NIL might cause an exception.

> Thanks, 
> DBM 
>========================================================= 
>
> procedure TForm1.Button1Click(Sender: TObject); 
> var 
>   readit,writeit: TFileStream; 
>   s: string; 
>   x:integer; 
> begin 
>   readit  := TFileStream.Create('n1.exe', fmOpenread); 
>   writeit := TFileStream.Create('n2.exe', fmCreate or fmOpenWrite); 
>   try 
>     SetLength(s,readit.Size); 
      if length(s)>0
>     readit.Read(PChar(s)^, Length(s)); 
>     s:=reversestring(s);  //<<<<<<-This line is incorrect 
>     writeit.Write(PChar(s)^, Length(s)); 
>   finally 
>     readit.Free; 
>     writeit.Free; 
>   end; 
> end; 

Back to comp.lang.pascal.delphi.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

xpost (Sorry) Can someone show me the fix for this please? bok <bok.globule@gmail.com> - 2012-07-19 11:45 -0700
  Re: xpost (Sorry) Can someone show me the fix for this please? Marco van de Voort <marcov@toad.stack.nl> - 2012-07-19 19:45 +0000
    Re: xpost (Sorry) Can someone show me the fix for this please? bok <bok.globule@gmail.com> - 2012-07-19 16:26 -0700
    Solution Found !!! bok <bok.globule@gmail.com> - 2012-07-19 17:54 -0700
      Re: Solution Found !!! Marco van de Voort <marcov@toad.stack.nl> - 2012-07-20 12:27 +0000

csiph-web