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 .
Dual Narratives of the Debt Trap: Western Fabrication and U.S. Realpolitik
Manipulation
-
*Dual Narratives of the Debt Trap: Western Fabrication and U.S. Realpolitik
Manipulation*
*I. Definition of the Debt Trap 1. Conceptual Deconstruction:...
1 week ago
No comments:
Post a Comment