Hi, Andrew!
Also, you can use booster/nowide/fstream.h (for working with UTF-8 strings in Windows, or using std namespace instead - see http://art-blog.no-ip.info/cppcms_ref_v0_99/namespacebooster_1_1nowide.html), for example:
//write string to file
std::string path = "/foor/bar";
booster::nowide::ofstream ofs(path.c_str(), ios::out | ios::app);
ofs << "test" << std::endl
//read whole file to stringstream
stringstream ss;
std::vector<char>buff;
booster::nowide::ifstream fl(attrfile.c_str(), ios::in)
if(fl){
fl.seekg(0, std::ios::end);
std::streampos len = fl.tellg();
buff.resize(len);
fl.seekg(0, std::ios::beg);
fl.read(&buff[0],len);
ss.rdbuf()->pubsetbuf(&buff[0],len);
fl.close();
}
26.04.2011, 18:10, "Andrew" <an...@bu...>:
> Hi Artyom.
>
> Is there a built-in cppcms api for reading file content directly from the file system? or should I just look at the boost library?
>
> Thanks :)
>
> - Andrew
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
|