c++ - Including white spaces using sscanf -


code

sscanf(szbuf, "%s %c %s", sztmp1, &szchar, sztmp2); 

where szubuff fetch_query = select name table1

szchar =

szbuf, sztmp1, sztmp2 character arrays. problem sztmp2 storing select , ignoring rest. need complete select name table1 inside sztmp2

#include <stdio.h> #include <string.h>  int main(int argc, const char **argv) {     char str[] = "fetch_query = select name table1";     char *qry, *sql;      qry = strtok(str, "=");     sql = strtok(0, "=");     printf("%s -- %s\n", qry, sql);     return 0; } 

output:

fetch_query  --  select name table1 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -