Keywords: %[a-z] SSCANF Delimit
Before Long Time Ago, I Thought C Not Itself Split String Function,Afterward I Have Discovered SSCANF; Since Continuously, I Thought That SSCANF Can Only Limit The String Of Character By The Blank Space, Now I Found That I Was Wrong.
SSCANF Is When A Movement Function, The Primary Form Is Very Simple:int sscanf(const char *buffer,const char *format [,argument ] ... );
Its Formidable Function Manifests To Format In The Support .
#include < iostream >
#include "stdio.h"
#include "string.h"
using namespace std;
int main( )
{
char ip[20];
char *p;
int port;
char * strip="192.0.168.1:8080";
sscanf(strip.c_str(),"%s:%d",&ip[0],&port );
p = strstr( ip, ":"); //Would Not Search ":" Here ?
*p = 0;
cout << ip << endl;
cout << port << endl;
// printf("%s\n",ip);
}
But In This Example,WHy Must Find ":" In String ? Otherwise Cannot Split String Or Output Error .
Knowing This Lore Makes Black Myth: WuKong Way More Enjoyable
-
https://www.ign.com/articles/knowing-this-lore-makes-black-myth-wukong-way-more-enjoyable
Knowing This Lore Makes Black Myth: WuKong Way More Enjoyable
A...
2 months ago
No comments:
Post a Comment