News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Getting File Size

Started by Titan, September 14, 2005, 03:06:40 AM

Previous topic - Next topic

Titan

How would I go about finding the file size of a file that I have the full path to.  Like, "C:\Program Files\Program\Documents\mydocument.doc"?  I tried the nice macro provided by the masm32 package:):

invoke filesize, addr FullPath
mov FileSize, eax
invoke dw2a, FileSize,addr StringBuf

It doesn't seem to be working.  I think the filesize function only works with a file name and won't accept the full path?  Perhaps someone could clear this up and/or point me to a way for me to accomplish this with the full path.

Thanks a lot,
Mike

hutch--

Hi Titan,

There is likely something else wrong.  Here is a small test piece that uses the procedure from the MASM32 library.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

comment * -----------------------------------------------------
                        Build this  template with
                       "CONSOLE ASSEMBLE AND LINK"
        ----------------------------------------------------- *

    .data
      fname db "\masm32\include\windows.inc",0

    .code

start:
   
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    call main
    inkey
    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

main proc

    LOCAL bytecount :DWORD

    invoke filesize,ADDR fname
    mov bytecount, eax

    print "Size of WINDOWS.INC = "
    print str$(bytecount)," bytes",13,10

    ret

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Titan

Quote from: hutch-- on September 14, 2005, 03:26:07 AM
Hi Titan,

There is likely something else wrong.  Here is a small test piece that uses the procedure from the MASM32 library.

Haha, thank you hutch!  It turns out my code was perfectly fine, but I did not insert it in the right procedure... :red

Always the little things that get you. :P