By the way, if anyone knows the answer to these, I'd be a very happy
person!
- How the heck do you get a file's size?
- How do you find out if there's a disk in a drive, without the [System
Error] box appearing? (The I/O Checking option doesn't help)
- Where is the FAQ for this newsgroup?
Many thanks,
-Asmfont
ACHOO! Asmfont. Thanks... Quisenart. What?!?
> I am I insane, or are all Delphi TPanels missing a pixel in the
>bottom-right hand corner! I would really appreciate a response, as I might
>have my version damaged!
I can't find a missing pixel in mine. The method I used to look was
to alt-prtscr to the clipboard and examine a pasted copy under
magnification in paintbrush. How are you seeing a missing pixel and
what are you seeing? I seem to recall that one of the corner pixels
in a bitmap is the one that indicates what the transparent color is,
that is the only oddity about corners that I remember. BTW, I checked
my panels both with and without bevels.
Tom
>In article <46mbeh$5...@newsbf02.news.aol.com>, asm...@aol.com (Asmfont) wrote:
>> By the way, if anyone knows the answer to these, I'd be a very happy
>> person!
>> - How the heck do you get a file's size?
>In other languages - Turbo Pascal and C++ - the most popular way (and
>only?) way of finding the size of a file is:
>(i) Open the file
>(ii) Make sure the file pointer is positioned at the start
>(iii) Seek to 0 bytes from the end of the file
>(iv) Get the file pointer's position
Unless there is something complicated going on, the easy way is to
use the built in Delphi function FileSize. One might need to wrap it
up somehow so that it deals with TextFiles in some sort of way (since
FileSize is not supposed to work with textfiles--I wonder what is
going on in the implementation to prevent it, seems strange to me--
e.g. one might reopen the file as an untyped file just long enough to
ask its size, then close (crazy thing to have to do))
Hhhm. For those who have the source, the code for FileSize is in
ffun.asm in source\rtl\sys --- a quick glance does not indicate to
me why it needs a not textfile. It does look like it is dashing
to end of file and asking how far have I gone, though, so it seems to
be working on the method Jeremy suggested.
Tom
here I quote from Delphi.hlp:
FileSize Function
See Also Example I/O routines
Unit
System
Declaration
function FileSize(var F): Longint;
Description
The FileSize function returns the size in bytes of file F. However, if
F is a record file FileSize will return the number of records in the
file. To use FileSize the file must be open and it can't be used on a
text file. F is a file variable.
If the file is empty, FileSize(F) returns 0.
{$I+} lets you handle run-time errors using exceptions. For more
information on handling run-time library exceptions, see Handling RTL
Exceptions.
If you are using {$I-}, you must use IOResult to check for I/O errors.
> By the way, if anyone knows the answer to these, I'd be a very happy
> person!
> - How the heck do you get a file's size?
In other languages - Turbo Pascal and C++ - the most popular way (and
only?) way of finding the size of a file is:
(i) Open the file
(ii) Make sure the file pointer is positioned at the start
(iii) Seek to 0 bytes from the end of the file
(iv) Get the file pointer's position
I might be wrong but I think TP and probably Delphi doesn't have functions
to move the file pointer. If this is the case there is a Windows API
function (_llseek ?) to do the same and there is also a DOS int 21 seek
function which returns the file position when you change it.
The only other problem is that depending on the way you opened the file it
might be difficult to get hold of the file handle to pass to _llseek. If
you are using Pascal FILEs then you will need to type cast it (I can't
remember the name of the type but it's in the Input/Output section of my
Turbo Pascal manual). Otherwise you will have to use Windows' openfile
function.
--
--- Jeremy Sanders, Pembroke College, Cambridge, CB2 1RF. js...@cam.ac.uk --
--- Look up. What do you see? Billions of worlds looking back --------------
--- WWW Suggestion: http://cool.infi.net -----------------------------------
To get the size of a file try the function FileSize(F). It returns
a longint which is either the size of the file in bytes or the
number of records if the file is one of records. Check the
Delphi Help for details.
Martin.
--
-----------------------------------------------------------------------------
| Martin Holland mar...@tlaloc.demon.co.uk 10001...@compuserve.com |
-----------------------------------------------------------------------------
: In other languages - Turbo Pascal and C++ - the most popular way (and
: only?) way of finding the size of a file is:
[big long, ugly suggestion deleted]
What's wrong with the FileSize() function?
--
David & Hellen Becker
bec...@teleport.com