http://msdn.microsoft.com/en-us/library/w40768et(VS.80).aspx
The link above is to an MSDN article which might be of help.
scanf_s and
wscanf_s require the buffer size to be specified for all input parameters of type c, C, s, S, or [. The buffer size is passed as an additional parameter immediately following the pointer to the buffer or variable. For example, if reading a string, the buffer size for that string is passed as follows:
char s[10];
scanf("%9s", s, 10);
The buffer size includes the terminating null. A width specification field
may be used to ensure that the token read in will fit into the buffer. If no width specification field is used, and the token read is too big to fit in the buffer, nothing will be written to that buffer.
This example uses char arrays instead of char*
#include <Windows.h>
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int CanLoop = 1;
//char* StringDecodedA[6] ;
int StringDecodedB[6] ;
char hereItIs[6], thereItIs[6];
void StringDecoder(string Str);
void MapDecode(string Str);
int main()
{
//////////
// begining
string MainString = "2|65|32|23|";
string A = ">> Wall 2 File <<";
for(int i=0;i<6;i++)
{
StringDecodedB[i]=-1;
//StringDecodedA[i]="-1";
}
//decode the string
MapDecode(A);
cout << hereItIs<< endl;
cout << StringDecodedB[1] << endl;
cout << thereItIs << endl;
//pause
system("pause");
//return to windows
return -1;
}
void StringDecoder(string Str)
{
sscanf_s(Str.c_str(),"%d|%d|%d|%d",&StringDecodedB[0],&StringDecodedB[1],&StringDecodedB[2],&StringDecodedB[3]);
}
void MapDecode(string Str)
{
sscanf_s(Str.c_str(),">> %s %d %s <<",&hereItIs,6,&StringDecodedB[1], &thereItIs,6);
}