reading from sd April 07, 2009 03:59PM | Registered: 15 years ago Posts: 24 |
Re: reading from sd April 07, 2009 04:08PM | Registered: 15 years ago Posts: 1,012 |
Re: reading from sd April 07, 2009 07:44PM | Registered: 15 years ago Posts: 24 |
Re: reading from sd April 07, 2009 08:01PM | Registered: 15 years ago Posts: 9 |
#include fat.h // Should have angle brackets but this forum doesn't display them ... fatInitDefault(); fatMountSimple("sd", &__io_wiisd);
Re: reading from sd April 08, 2009 08:23AM | Registered: 15 years ago Posts: 24 |
Re: reading from sd April 08, 2009 08:36AM | Registered: 15 years ago Posts: 703 |
Re: reading from sd April 08, 2009 08:50PM | Registered: 15 years ago Posts: 441 |
Re: reading from sd April 08, 2009 08:51PM | Registered: 15 years ago Posts: 441 |
Quote
scanff
If you're just wanting to read a file then...fatInitDefault(); FILE* f; char buf[50] = {0}; f = fopen("/hello.txt","r"); // will be root of the SD fread(buf,50,1,f); fclose(f);
Re: reading from sd April 08, 2009 08:59PM | Registered: 15 years ago Posts: 441 |
fatInitDefault(); // should only be called once // will read in the whole file char * buffer; // file buffer int size = 0; // file size FILE* file = fopen("sd:/hello.txt","rb"); if(file > 0) { struct stat fileinfo; fstat(file->_file, &fileinfo); size = fileinfo.st_size; buffer = (char *)malloc(size); fread(buffer, 1, size, file); fclose(file); } // call this when you're done with the file data free(buffer);
Re: reading from sd April 11, 2009 01:04PM | Registered: 15 years ago Posts: 24 |
Quote
Tantric
Here's a better example:
This was what I was looking for...perfect example!!!fatInitDefault(); // should only be called once // will read in the whole file char * buffer; // file buffer int size = 0; // file size FILE* file = fopen("sd:/hello.txt","rb"); if(file > 0) { struct stat fileinfo; fstat(file->_file, &fileinfo); size = fileinfo.st_size; buffer = (char *)malloc(size); fread(buffer, 1, size, file); fclose(file); } // call this when you're done with the file data free(buffer);
Code Dump??? April 17, 2009 03:17AM | Registered: 15 years ago Posts: 8 |
Re: reading from sd April 17, 2009 06:20AM | Registered: 15 years ago Posts: 703 |
FILE* fp = 0; fp=fopen("sd:/gamefile.dat","rb"); if(!fp) exit(0);
Re: reading from sd April 17, 2009 11:30PM | Registered: 15 years ago Posts: 8 |
Re: reading from sd July 01, 2009 12:10AM | Registered: 14 years ago Posts: 42 |
#include#include #include #include #include #include "FileIO.h" namespace FileIO{ void InitFat(){ //__io_wiisd.startup(); //fatMountSimple("sd", &__io_wiisd); fatInitDefault(); fatMountSimple("sd", &__io_wiisd); } //This is the function it crashes on... void SDTest(){ FILE* test; test = fopen("sd:/test.txt", "rw"); fprintf(test, "Hello World!\n"); fclose(test); } }
Re: reading from sd July 01, 2009 12:37AM | Registered: 14 years ago Posts: 42 |
#include#include #include #include #include #include "FileIO.h" namespace FileIO{ void InitFat(){ //__io_wiisd.startup(); //fatMountSimple("sd", &__io_wiisd); fatInitDefault(); //fatMountSimple("sd", &__io_wiisd); } void SDTest(){ FILE* test; test = fopen("test.txt", "w"); fprintf(test, "Hello World!\n"); fclose(test); } }
Re: reading from sd July 02, 2009 08:46AM | Registered: 14 years ago Posts: 59 |
Re: reading from sd July 02, 2009 09:59AM | Registered: 15 years ago Posts: 276 |
Re: reading from sd July 02, 2009 12:25PM | Registered: 14 years ago Posts: 59 |