Problems with NitroFS

Post Reply
thiagoauler
Posts: 5
Joined: Wed Aug 26, 2009 8:17 pm

Problems with NitroFS

Post by thiagoauler » Wed Aug 26, 2009 8:27 pm

Hi, everyone,

This is my question:
Does someone know why fopen call is not working??

Here is my code:

Code: Select all

#include <nds.h>
#incluide <filesystem.h>
#include <stdio.h>

int main(void)
{
consoleDemoInit();
nitroFSInit();
FILE *f = fopen("nitro:/hello_world.txt", "rb");
if (f != NULL)
{
	fscanf(f, "%s", str);
	printf("%s", str);
}
else
	printf("error!");

return 0;
}
I'm using the nitrofs example as basis...

TIA

StevenH
Posts: 133
Joined: Sun Feb 22, 2009 7:59 pm

Re: Problems with NitroFS

Post by StevenH » Wed Aug 26, 2009 8:56 pm

need the context that it's not working in - emulator, hardware etc...

Basically put down everything that you've done to get to that point, where's the files stored in your nitro folder, how your testing etc...

thiagoauler
Posts: 5
Joined: Wed Aug 26, 2009 8:17 pm

Re: Problems with NitroFS

Post by thiagoauler » Wed Aug 26, 2009 11:12 pm

Hi...

The example I'm using as basis can be found here:
<devkitPro>\examples\nds\filesystem\nitrofs\nitrodir

This example worked fine, I tested using no$gba.
But the "problem" is when I did some modifications to use "FILE *fopen(...)" instead of "DIR *diropen(...)"

The filesystem files are inside a folder called nitrofiles... and I just added mine for testing...
Ahh, very important... no error on compiling and executing... :mrgreen:
The actual problems happens in fopen command... it returns an NULL handle :|

thiagoauler
Posts: 5
Joined: Wed Aug 26, 2009 8:17 pm

Re: Problems with NitroFS

Post by thiagoauler » Wed Aug 26, 2009 11:28 pm

Man... i just can't believe...

I put hello_world.txt.txt in my folder...
:lol:

what a mistake.... lol
now it's working like a charm!

thanks

dheart88
Posts: 44
Joined: Sun Dec 13, 2009 3:00 pm

Re: Problems with NitroFS

Post by dheart88 » Sun Dec 13, 2009 3:47 pm

you didn't declare str btw...
well, when it tried to declare
char* str;
the result is (null).. but when i convert it as integer
int str
it works... (as long as the text only consist number , like 1, 2 etc)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests