boost::format
-
Hi all, Im having char *data = new char[256]; if i use cstring like, std::string logFolder; CString temp1; temp1.Format(L"%s",data); USES_CONVERSION; logFolder = T2A(temp1); I am able to get the correct path from data. If i use like, std::string temp; temp = (boost::format("%s") % data).str(); logFolder = temp; i cant get the correct string from data.. Anyone knows how to format the char array?Is parsing needed?Pls help me. Thanx..
-
Hi all, Im having char *data = new char[256]; if i use cstring like, std::string logFolder; CString temp1; temp1.Format(L"%s",data); USES_CONVERSION; logFolder = T2A(temp1); I am able to get the correct path from data. If i use like, std::string temp; temp = (boost::format("%s") % data).str(); logFolder = temp; i cant get the correct string from data.. Anyone knows how to format the char array?Is parsing needed?Pls help me. Thanx..
Try
boost::format("%1%") % data
«_Superman_»
I love work. It gives me something to do between weekends. -
Try
boost::format("%1%") % data
«_Superman_»
I love work. It gives me something to do between weekends. -
Not working.Its also gives the first letter only.. Is any other syntax to display the char array in boost format?? Pls help me.
Oh! Yes of course. You
wchar_t
instead ofchar
.«_Superman_»
I love work. It gives me something to do between weekends. -
Oh! Yes of course. You
wchar_t
instead ofchar
.«_Superman_»
I love work. It gives me something to do between weekends. -
Hi all, Im having char *data = new char[256]; if i use cstring like, std::string logFolder; CString temp1; temp1.Format(L"%s",data); USES_CONVERSION; logFolder = T2A(temp1); I am able to get the correct path from data. If i use like, std::string temp; temp = (boost::format("%s") % data).str(); logFolder = temp; i cant get the correct string from data.. Anyone knows how to format the char array?Is parsing needed?Pls help me. Thanx..
This code works fine for me:
// Console.cpp : Defines the entry point for the console application.
//#include "stdafx.h"
#include <tchar.h>
#include <iostream>
#include <boost/format.hpp>using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
using namespace boost;const char \*pData = "world"; format fmt("Hello %1%!"); fmt % pData; cout << fmt; cout << endl; return 0;
}
The output is:
Hello world!
Steve
-
This code works fine for me:
// Console.cpp : Defines the entry point for the console application.
//#include "stdafx.h"
#include <tchar.h>
#include <iostream>
#include <boost/format.hpp>using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
using namespace boost;const char \*pData = "world"; format fmt("Hello %1%!"); fmt % pData; cout << fmt; cout << endl; return 0;
}
The output is:
Hello world!
Steve