It is currently Fri Feb 26, 2021 6:56 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Getting Free Disk Space
PostPosted: Tue May 27, 2014 5:02 pm 
Offline
User
User

Joined: Sun May 14, 2006 12:33 am
Posts: 29
I had a variable that bothered elsewhere in my code, it works perfectly now

Thank you very much for your help: D

_________________
.:NY152:.


Top
 Profile  
Reply with quote  
 Post subject: Re: Getting Free Disk Space
PostPosted: Wed Feb 17, 2021 8:17 pm 
Offline
New User
New User

Joined: Sun Dec 06, 2020 11:27 am
Posts: 4
Hi everybody.

I tried this code but when I call "GetDiskFreeSpaceEx_()" I get the error: "GetDiskFreeSpaceEx_() is not a function, array, list, map or macro".

Perhaps this code is not valid in current version of PureBasic?

Thanks in advance!!


Top
 Profile  
Reply with quote  
 Post subject: Re: Getting Free Disk Space
PostPosted: Wed Feb 17, 2021 8:27 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3873
PureBasic demo version don't support Windows API calls

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Getting Free Disk Space
PostPosted: Wed Feb 17, 2021 8:34 pm 
Offline
New User
New User

Joined: Sun Dec 06, 2020 11:27 am
Posts: 4
RASHAD wrote:
PureBasic demo version don't support Windows API calls


Thanks you for you fast answer, but I'm using the full version of PureBasic, not trial.


Top
 Profile  
Reply with quote  
 Post subject: Re: Getting Free Disk Space
PostPosted: Thu Feb 18, 2021 5:40 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2432
Location: Singapore
JoseT wrote:
...when I call "GetDiskFreeSpaceEx_()" I get the error: "GetDiskFreeSpaceEx_() is not a function, array, list, map or macro".

GetDiskFreeSpaceEx() is a Windows API function, and will not work on MacOS or Linux. This example includes MacOS API calls for similar functionalities:
Code:
Define.q availableSize, totalSize, freeSize

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  GetDiskFreeSpaceEx_("C:", @availableSize, @totalSize, @freeSize)
CompilerElseIf #PB_Compiler_OS = #PB_OS_MacOS
  fm = CocoaMessage(0, 0, "NSFileManager defaultManager")
  fs = CocoaMessage(0, fm, "attributesOfFileSystemForPath:$", @"/", "error:", #nil)
  sz = CocoaMessage(0, fs, "objectForKey:$", @"NSFileSystemSize")
  fs = CocoaMessage(0, fs, "objectForKey:$", @"NSFileSystemFreeSize") 
  CocoaMessage(@freeSize, sz, "longLongValue")
  CocoaMessage(@totalSize, fs, "longLongValue")
CompilerEndIf

Debug "Total: " + FormatNumber(totalSize, 0) + " bytes"
Debug "Free: " + FormatNumber(freeSize, 0) + " bytes"

_________________
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!


Top
 Profile  
Reply with quote  
 Post subject: Re: Getting Free Disk Space
PostPosted: Thu Feb 18, 2021 5:56 pm 
Offline
New User
New User

Joined: Sun Dec 06, 2020 11:27 am
Posts: 4
JoseT wrote:
RASHAD wrote:
PureBasic demo version don't support Windows API calls


Thanks you for you fast answer, but I'm using the full version of PureBasic, not trial.


Finally, this problem was solved with reinstallation of PB. I think you are right, my installation was corrupted, I supose.

Thaks a lot!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye