Re: StrFormatByteSize64: how to use it?
- From: Nicholas Sherlock <n_sherlock@xxxxxxxxxxx>
- Date: Sun, 19 Jun 2005 13:05:39 +1200
Matteo Riso wrote:
procedure TForm1.DimFile(Siz: Int64): string; var filesize: PAnsiChar; begin StrFormatByteSize64(Siz, FileSize,255); .... end;
When I execute this program StrFormatByteSize64 converts the value to string, but it raises also an "Access Violation" error.
You haven't reserved any memory for your PAnsiChar, it's just a pointer to nowhere in particular. Try this:
procedure TForm1.DimFile(Siz: Int64): string;
var
filesize: string;
begin
setlength(filesize,255);
setlength(filesize,StrFormatByteSize64(Siz, pchar(FileSize),length(filesize)));
end;
Cheer, Nicholas Sherlock .
- References:
- StrFormatByteSize64: how to use it?
- From: Matteo Riso
- StrFormatByteSize64: how to use it?
- Prev by Date: StrFormatByteSize64: how to use it?
- Next by Date: Re: dynamic creating Timage, win98 vs xp problem
- Previous by thread: StrFormatByteSize64: how to use it?
- Index(es):
Relevant Pages
|