Sign in to follow this  
Followers 0
ken82m

Convert uint64 from _FTP_FileGetSize to Megabytes

4 posts in this topic

#1 ·  Posted (edited)

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

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0