how to use swscanf

I made this program, but not getting the desired result. Please suggest how to proceed.

#include <wchar.h>

using namespace std;

int main(int argc, char *argv[]) {

wchar_t temp[10] = L"123456789";

int tempDest[50];


wchar_t format[4] = L"%d";

//I want to convert string in temp as format specified
int i = swscanf(temp, format, tempDest);



This is the output-
80478c0 // data of tempDest before call to swscanf
80478c0 // data of tempDest after call to swscanf
Welcome to the QNX Momentics IDE

So, you have an pointer (to static array) tempDest. If you want to get read value try

cout<<tempDest[0]<<endl; // tempDest would print just value of static pointer

in swscanf(temp, format, tempDest); you read data from input just into tempDest[0] because tempDest == &(tempDest[0]) if you understand what I mean.

You would get a lot more feedback if you ask these question in C/C++ forum.