Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

Jesuaw

@Jesuaw
About
Posts
3
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • swscanf_s White Space Help
    J Jesuaw

    I see. Thanks again for your help. Cheers

    C / C++ / MFC data-structures help question

  • swscanf_s White Space Help
    J Jesuaw

    Thank 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

    C / C++ / MFC data-structures help question

  • swscanf_s White Space Help
    J Jesuaw

    Hello, 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?

    C / C++ / MFC data-structures help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups