//Reading file sample io::IReadFile *f = App::Instance()->GetDevice()->getFileSystem()->createAndOpenFile("didum/dadam/anykindoffile.ext"); //this is how you get actual path (physical/not relative), it will return the input given to it if no actual path was found io::path p = App::Instance()->GetDevice()->getFileSystem()->getAbsolutePath("didum/dadam/anykindoffile.ext"); //preparing a buffer to save the file contents char *buffer = new char[f->getSize()]; long fl = f->getSize(); //read that file to the buffer f->read(buffer, f->getSize()); //writing file sample io::IWriteFile *wf = App::Instance()->GetDevice()->getFileSystem()->createAndWriteFile("savedname.saved"); wf->write(buffer, f->getSize()); wf->drop(); f->drop(); delete [] buffer;Fair warning though.. i did not included the safe checking for the file exists etc.. i guess you know where to put them right ;) Cheer!
Kamis, 25 Oktober 2012
[Irrlicht]Working with files:Intro
Hi there! if any of you need a quick code snippet to work with file in Irrlicht:
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar