Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Hello.World_of.C++
- Hello
- World
- of
- C++ */
- #include "stdafx.h"
- #include <iostream>
- #include <windows.h>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- // string to be splitted
- char the_string[] = "Hello.World_of.C++";
- // seperators
- char the_seperators[] = "._";
- // strtok() function returns a pointer to the next "token" in str1,
- // where str2 contains the delimiters that determine the token
- char* the_token = strtok(the_string, the_seperators);
- // loop until end
- while(the_token != NULL)
- {
- cout << the_token << endl;
- // tokenize the remaning string
- the_token = strtok(0, the_seperators);
- }
- // windows: 5s (windows.h)
- Sleep(5000);
- return 0;
- }
- // stdafx.h
- #pragma once
- #include "targetver.h"
- #include <stdio.h>
- #include <tchar.h>
- // targetver.h
- #pragma once
- #include <SDKDDKVer.h>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement