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


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

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

From bok <bok.globule@gmail.com>
Newsgroups comp.lang.pascal.delphi.misc
Subject xpost (Sorry) Can someone show me the fix for this please?
Date 2012-07-19 11:45 -0700
Organization http://groups.google.com
Message-ID <c0df65a9-11ec-4a22-accc-cb05042612ce@googlegroups.com> (permalink)

Show all headers | View raw


Hello, 

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. 

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); 
    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 | NextNext in thread | Find similar | Unroll thread


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