I have below line of code:
char sPostData[500] = "{\"name\":\"Test Unique Name 1\",\"salary\":\"123456\"}";
where instead of Test Unique Name 1
I want to pass a variable value something like below:
string name = "JOHN";
char sPostData[500] = "{\"name\":" + name + "\",\"salary\":\"123456\"}";
But doing so it gives below error:
Error (active) E0520 initialization with '{...}' expected for aggregate object
Error C2440 'initializing': cannot convert from 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' to 'char []'
How can I resolve this issue and pass in the variable value in between. Thanks