Jump to content

Convert uint64 from _FTP_FileGetSize to Megabytes


ken82m
 Share

Recommended Posts

The _FTP_FileGetSize function returns 27170371136389120 which is supposed to be a uint64 integer.

I don't see why it doesn't just return the value in bytes...

I've never seen that type of variable used anywhere except a DllCall which I've never understood I just copy and paste lol

Anyway the file in this case is actually 6.2 mb

I'm not quite sure how to convert quadrillion whatevers to megabytes

I doubt the answer is to divide by 4,382,317,925,224,051.6129032258064516 lol :)

I could use INetGetSize but I can't find a way to retrieve the server I'm connected to using the _FTP commands.

Thanks,

Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

Because that is what the user of the function expects to return value to be :)

Local $iFileSize = 27170371136389120
Local $tInt64, $tIntInt

$tIntInt = DllStructCreate("uint Hi;uint Lo")
$tInt64 = DllStructCreate("uint64", DllStructGetPtr($tIntInt))

DllStructSetData($tInt64, 1, $iFileSize)
ConsoleWrite(DllStructGetData($tIntInt, "Hi") & @CRLF & DllStructGetData($tIntInt, "Lo") & @CRLF)
ConsoleWrite(Int($iFileSize/4294967296) & @CRLF)
Link to comment
Share on other sites

Because that is what the user of the function expects to return value to be :)

Local $iFileSize = 27170371136389120
Local $tInt64, $tIntInt

$tIntInt = DllStructCreate("uint Hi;uint Lo")
$tInt64 = DllStructCreate("uint64", DllStructGetPtr($tIntInt))

DllStructSetData($tInt64, 1, $iFileSize)
ConsoleWrite(DllStructGetData($tIntInt, "Hi") & @CRLF & DllStructGetData($tIntInt, "Lo") & @CRLF)
ConsoleWrite(Int($iFileSize/4294967296) & @CRLF)

Now why didn't I think of all that LOL

Thanks man ;)

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

you should not need to convert it. The return value is in bytes and AutoIt handles UINT64 :)

In AutoIt v3.3.1.3 there was an error in _FTP_FileGetSize (Ticket: #1167, fixed in 3.3.1.4)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...