![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sscanf function is failing | jxh461 | High Level Programming | 0 | 02-13-2007 08:10 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
sscanf !!
I have a string
Quote:
Quote:
Code:
#include <stdio.h>
char buf_2[50];
int
main()
{
char *buf_1 = "\\\\?\\whats going on";
sscanf(buf_1, "\\\\?\\%s", buf_2);
printf("buf_1 = %s\n", buf_1);
printf("buf_2 = %s\n", buf_2);
printf("Thats all folks... !\n");
return 0;
}
Quote:
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
char *buf_2=buf_1; if (!memcmp(buf_2,"\\\\?\\",4)) buf_2+=4; |
|
#3
|
|||
|
|||
|
Proter ! thats just awesome man... Thanks !!
|
|
#4
|
|||
|
|||
|
As long as you understand what it is doing.
|
|
#5
|
|||
|
|||
|
Change your sscanf as below and then try.
sscanf(buf_1, "\\\\?\\%49c", buf_2); |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|