GSLAM  3.0.0
Binary Built-in File Resource

Sometimes we want to use a file resource inside the binary just like the "*.qrc" in Qt.

GSLAM provides a tiny and efficient way to access such functional.

gslam resource -map {\"inside_name.png\":\"folder/name.png\",\"hello.txt\":\"hello.txt\"} -cpp resource.cpp
Warning
'\' is essential to prevent '"' gone.

This command will package file "folder/name.png" and "hello.txt" to the resource cpp file "resource.cpp".

#include <GSLAM/core/FileResource.h>
int main(int argc,char** argv)
{
std::istream& ist=GSLAM::FileResource::getIStream("hello.txt");
// now please use ist just like ifstream
// also can access the file with buffer
SvarBuffer buffer=GSLAM::FileResource::getBuffer("hello.txt");
std::cerr<<"size is:"<<buffer.length()
<<"context is:"<<buffer.hex();
return 0;
}