Click here to Skip to main content
15,892,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Using Timer with non-dialog class Pin
PJ Arends25-Oct-11 17:44
professionalPJ Arends25-Oct-11 17:44 
GeneralRe: Using Timer with non-dialog class Pin
PJ Arends25-Oct-11 17:52
professionalPJ Arends25-Oct-11 17:52 
GeneralRe: Using Timer with non-dialog class Pin
Richard MacCutchan25-Oct-11 22:24
mveRichard MacCutchan25-Oct-11 22:24 
AnswerRe: Using Timer with non-dialog class Pin
Chuck O'Toole26-Oct-11 5:09
Chuck O'Toole26-Oct-11 5:09 
GeneralRe: Using Timer with non-dialog class Pin
aangerma26-Oct-11 9:42
aangerma26-Oct-11 9:42 
GeneralRe: Using Timer with non-dialog class Pin
Chuck O'Toole26-Oct-11 9:47
Chuck O'Toole26-Oct-11 9:47 
GeneralRe: Using Timer with non-dialog class Pin
aangerma26-Oct-11 10:17
aangerma26-Oct-11 10:17 
QuestionI don't understand the value of a token strtok_s Pin
jkirkerx24-Oct-11 13:42
professionaljkirkerx24-Oct-11 13:42 
I see all kinds of articles and documents on tokens using strtok_s, but none of them show how to get or capture the actual value of a token.

It looks like a token is a pointer, to a place in a char array. but it doesn't seem to give you the length. In the autos, it looks like an array of chars, but I know better now.

char *szServerName[50] = {""};
szServerName = token2;

would be invalid,

I figured out how to step through the source char array in a name value pair
eg. ServerName, DELL760
token1 = ServerName
token2 = DELL760

but I can't figure out how to capture the values. Plus you can't run token1 in a switch, because there is nothing to compare to.


C#
void CA_SQLServer_Scan::_process_SQL_BufferData( std::vector<char> pData, int pLength )
{
    //  Copy the vector into a char array
    int msgLength = pData.size();
    char *szWords = new char[msgLength+1];
    for (int i = 0; i < msgLength; i++) {
      szWords[i] = pData[i];
    }
    szWords[ pData.size() ] = '\0';

    char seps[] = ";";
    char *token1, *next_token1, *token2, *next_token2;
    char *szServerName[50] = {""};
    char *szInstanceName[50] = {""};
    char *szClustered[5] = {""};
    char *szVersion[25] = {""};
    char *szTCP[5] = {""};
    char *szNP[80] = {""};

    if ( strcmp( szWords, "ServerName" ) !=0 &&
        strcmp( szWords, "InstanceName" ) !=0 &&
        strcmp( szWords, "Version" ) !=0)
    {
        token1 = strtok_s( szWords, seps, &next_token1);
        token2 = strtok_s( next_token1, seps, &next_token1);

        // Grab the first name value pair
        // szServerName = token2

        while (token1 != NULL || token2 !=NULL)
        {
            if ( token1 !=NULL || token2 !=NULL )
            {
                // The rest of the name value pairs
                token1 = strtok_s( next_token1, seps, &next_token2);
                token2 = strtok_s( next_token2, seps, &next_token1);
            }
        }
    }

    delete [] szWords;
}

AnswerRe: I don't understand the value of a token strtok_s Pin
Software_Developer24-Oct-11 14:07
Software_Developer24-Oct-11 14:07 
GeneralRe: I don't understand the value of a token strtok_s Pin
Richard MacCutchan24-Oct-11 21:45
mveRichard MacCutchan24-Oct-11 21:45 
AnswerRe: I don't understand the value of a token strtok_s Pin
Malli_S24-Oct-11 18:55
Malli_S24-Oct-11 18:55 
GeneralRe: I don't understand the value of a token strtok_s Pin
jkirkerx25-Oct-11 5:54
professionaljkirkerx25-Oct-11 5:54 
AnswerRe: I don't understand the value of a token strtok_s Pin
Richard MacCutchan24-Oct-11 21:44
mveRichard MacCutchan24-Oct-11 21:44 
GeneralRe: I don't understand the value of a token strtok_s Pin
jkirkerx25-Oct-11 6:11
professionaljkirkerx25-Oct-11 6:11 
GeneralRe: I don't understand the value of a token strtok_s Pin
Richard MacCutchan25-Oct-11 6:41
mveRichard MacCutchan25-Oct-11 6:41 
GeneralRe: I don't understand the value of a token strtok_s Pin
jkirkerx25-Oct-11 6:52
professionaljkirkerx25-Oct-11 6:52 
GeneralRe: I don't understand the value of a token strtok_s Pin
Richard MacCutchan25-Oct-11 7:07
mveRichard MacCutchan25-Oct-11 7:07 
QuestionSplitter with fixed size Pin
Dialecticus24-Oct-11 8:28
Dialecticus24-Oct-11 8:28 
AnswerRe: Splitter with fixed size Pin
App_24-Oct-11 9:04
App_24-Oct-11 9:04 
GeneralRe: Splitter with fixed size Pin
Dialecticus24-Oct-11 9:30
Dialecticus24-Oct-11 9:30 
AnswerRe: Splitter with fixed size Pin
TheGreatAndPowerfulOz24-Oct-11 9:51
TheGreatAndPowerfulOz24-Oct-11 9:51 
GeneralRe: Splitter with fixed size Pin
Dialecticus24-Oct-11 10:04
Dialecticus24-Oct-11 10:04 
AnswerRe: Solution: use CSplitterWnd::SetRowInfo Pin
Goto_Label_24-Oct-11 11:18
Goto_Label_24-Oct-11 11:18 
GeneralRe: Solution: use CSplitterWnd::SetRowInfo Pin
Dialecticus24-Oct-11 22:48
Dialecticus24-Oct-11 22:48 
AnswerRe: Splitter with fixed size Pin
TheGreatAndPowerfulOz25-Oct-11 5:06
TheGreatAndPowerfulOz25-Oct-11 5:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.