Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > .NET

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-31-2009, 03:17 PM
cuterita7 cuterita7 is offline
Member
 
Join Date: Apr 2008
Posts: 92
Default WriteFile in Delphi for .NET

Hi

I have the following code in Delphi for .NET

procedure TForm1.Button3Click(Sender: TObject);
var
StrLine : string;
fDebug:String;
hfDebug: HFile;
arrofBytes:TBytes;
begin
fdebug := 'C:\testing.txt';
hfDebug := CreateFile(fDebug,GENERIC_WRITE,FILE_SHARE_READ,ni l,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
StrLine := 'An error occured';
Arrofbytes:=BytesOF(StrLine);
writefile(hfDebug,arrofBytes,Length(StrLine),nil,n il);
end;

I got the following error at writefile:Attempted to read or write protected memory.This is often an indication that other memory is corrupt

Why I am getting the error?

any help

thanks
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:55 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.