#55569 - dannyboy - Thu Sep 29, 2005 3:02 pm
Hey guys
just started deving for the DS and I'm wondering how do you save and read files to the SRAM? I've looked at Chris Doubles SRAM Tutorial and it's easy enough. However that just writes to the SRAM as one big chunk. What I want is say, read and write "123" to test1.txt and "456" to test2.txt. How is that done?
Also, do fstream and iostream work? Here's some code I wrote for the computer, how would this translate to the DS?
Thanks in advance for any light you can shed.
just started deving for the DS and I'm wondering how do you save and read files to the SRAM? I've looked at Chris Doubles SRAM Tutorial and it's easy enough. However that just writes to the SRAM as one big chunk. What I want is say, read and write "123" to test1.txt and "456" to test2.txt. How is that done?
Also, do fstream and iostream work? Here's some code I wrote for the computer, how would this translate to the DS?
Code: |
#include <iostream>
#include <string> #include <fstream.h> void WriteFile(const string Filename) { ofstream fout(Filename.c_str()); if (fout) { for(int i = 0; i < 9; i++) { fout << Age[i].Value; fout << endl; } } } void Read(const string Filename) { ifstream fin(Filename.c_str()); if (fin) { for(int i = 0; i < 9; i++) { fin >> Age[i].Value; } } fin.close(); } |
Thanks in advance for any light you can shed.