I see. Thanks again for your help. Cheers
Jesuaw
Posts
-
swscanf_s White Space Help -
swscanf_s White Space HelpThank you very much for your help. Works great. One more question please. How can I select all the characters till to a specific word? Say, I want to select all characters till "the" word? I tried
%[^(the)]
but to no avail. Cheers
-
swscanf_s White Space HelpHello, A wchar_t array contains two sentences inside which I need to save in two separate variables.
wchar_t str[] = L"'This is the first sentence' 'This is the second sentence'";
I want to split in a way that first sentence and second sentence equals to these:
wchar_t first_sentence[MAX_PATH]=L"'This is the first sentence'";
wchar_t second_sentence[MAX_PATH]=L"'This is the second sentence'";I am using below code but it does not work as expected.
#include "stdafx.h"
#include <wchar.h>
#include <windows.h>
#include <stdio.h>int _tmain(int argc, _TCHAR* argv[])
{
wchar_t str[] = L"'This is the first sentence' 'This is the second sentence'";wchar\_t first\_sentence\[MAX\_PATH\]; wchar\_t second\_sentence\[MAX\_PATH\]; swscanf\_s(str, L"'%s' '%s'", first\_sentence, \_countof(first\_sentence), second\_sentence, \_countof(second\_sentence)); printf("first\_sentence=%ls\\nsecond\_sentence=%ls\\n", first\_sentence, second\_sentence); system("PAUSE"); return 0;
}
As far as I understand swscanf_s is pausing when it encountes the first white space. How am I suppose to get whole string between single quotes with swscanf_s please?