LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

How to get space available?

Root / Programming Questions / [.]

HTV04Created:
I know FILES reports the space available, but I can't find a direct way to get it as a variable.

FREEMEM or FREESPACE or something like that

FREEMEM tells you the amount of free RAM available, but I think they're asking about free SD card space. There is no direct way to get the amount of free SD card space in SmileBASIC. I can think of a roundabout way to do it, by running FILES and then reading the screen with CHKCHR, but that's a bad idea for a number of reasons:
  • It won't work at all on SB4. In that version, FILES only prints the list of projects/files.
  • If there's too many files to fit on-screen, FILES will actually pause your program until the user presses A or Enter, which isn't ideal.
  • FILES will print to the console, so something like VISIBLE would have to be used if you want to hide that from the user. However, this interacts badly with the previous point, since the program would then appear to freeze until A or Enter is pressed, for no apparent reason.
Considering that SB3 files are a few megabytes at most (and usually much smaller than that), there's just not much point in going to all that trouble, especially with these caveats. The answer to "How much free space is available?" is almost always going to be "Enough".

FREEMEM tells you the amount of free RAM available, but I think they're asking about free SD card space. There is no direct way to get the amount of free SD card space in SmileBASIC. I can think of a roundabout way to do it, by running FILES and then reading the screen with CHKCHR, but that's a bad idea for a number of reasons:
  • It won't work at all on SB4. In that version, FILES only prints the list of projects/files.
  • If there's too many files to fit on-screen, FILES will actually pause your program until the user presses A or Enter, which isn't ideal.
  • FILES will print to the console, so something like VISIBLE would have to be used if you want to hide that from the user. However, this interacts badly with the previous point, since the program would then appear to freeze until A or Enter is pressed, for no apparent reason.
Considering that SB3 files are a few megabytes at most (and usually much smaller than that), there's just not much point in going to all that trouble, especially with these caveats. The answer to "How much free space is available?" is almost always going to be "Enough".
That's a bummer. Okay.

Considering that SB3 files are a few megabytes at most (and usually much smaller than that), there's just not much point in going to all that trouble, especially with these caveats. The answer to "How much free space is available?" is almost always going to be "Enough".
I don't think they are even one megabyte at all, bc making a program hasn't been effecting my 3ds storage much. Idk, but that's what I think.

Considering that SB3 files are a few megabytes at most (and usually much smaller than that), there's just not much point in going to all that trouble, especially with these caveats. The answer to "How much free space is available?" is almost always going to be "Enough".
I don't think they are even one megabyte at all, bc making a program hasn't been effecting my 3ds storage much. Idk, but that's what I think.
Yeah, the code itself is going to be tiny, typically a few kilobytes. I'm just saying that, even in the worst case, where you have big DAT files, they're generally not going to be so big that you have to worry about SD card space, since the upload size limit for a project is 4 MB, or 20 MB with a gold membership.

Considering that SB3 files are a few megabytes at most (and usually much smaller than that), there's just not much point in going to all that trouble, especially with these caveats. The answer to "How much free space is available?" is almost always going to be "Enough".
I don't think they are even one megabyte at all, bc making a program hasn't been effecting my 3ds storage much. Idk, but that's what I think.
Yeah, the code itself is going to be tiny, typically a few kilobytes. I'm just saying that, even in the worst case, where you have big DAT files, they're generally not going to be so big that you have to worry about SD card space, since the upload size limit for a project is 4 MB, or 20 MB with a gold membership.
Yeah. I just went through and deleted a ton of worthless projects and it freed like 400 blocks. That's a fifth of a megabyte for multiple projects.

If you are concerned about remaining space on your sd card you could pop out the card, put it in a computer and check. Or is this something that needs to be run within SmileBasic?

If you are concerned about remaining space on your sd card you could pop out the card, put it in a computer and check. Or is this something that needs to be run within SmileBasic?
I was just trying to make a more detailed FILES, and I wanted to include the space available like FILES does. I know how to check how much space I have left lol

If you are concerned about remaining space on your sd card you could pop out the card, put it in a computer and check. Or is this something that needs to be run within SmileBasic?
You don't have to put it in a computer. You can find the free space (in blocks) via system settings in data management. In data management you can click the top option and it'll show the free space on the top screen. On the bottom screen it'll show software downloaded on the SD card and the space they take up.