Page 1 of 1
Problems with NitroFS
Posted: Wed Aug 26, 2009 8:27 pm
by thiagoauler
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
Re: Problems with NitroFS
Posted: Wed Aug 26, 2009 8:56 pm
by StevenH
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...
Re: Problems with NitroFS
Posted: Wed Aug 26, 2009 11:12 pm
by thiagoauler
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...
The actual problems happens in fopen command... it returns an NULL handle
Re: Problems with NitroFS
Posted: Wed Aug 26, 2009 11:28 pm
by thiagoauler
Man... i just can't believe...
I put hello_world.txt.txt in my folder...
what a mistake.... lol
now it's working like a charm!
thanks
Re: Problems with NitroFS
Posted: Sun Dec 13, 2009 3:47 pm
by dheart88
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)