मैं एक स्ट्रिंग और एक स्ट्रिंग से बाहर एक पूर्णांक sscanf
का उपयोग कर निकालने के लिए कोशिश कर रहा हूँ:सी - काम नहीं कर रहा sscanf
#include<stdio.h>
int main()
{
char Command[20] = "command:3";
char Keyword[20];
int Context;
sscanf(Command, "%s:%d", Keyword, &Context);
printf("Keyword:%s\n",Keyword);
printf("Context:%d",Context);
getch();
return 0;
}
लेकिन यह मुझे उत्पादन देता है:
Keyword:command:3
Context:1971293397
मैं इस ouput की उम्मीद:
Keyword:command
Context:3
sscanf
बर्ताव करता है इस तरह क्यों पड़ता है? आपकी मदद के लिए अग्रिम धन्यवाद!
क्या कोई अच्छा कारण है कि आप 'sscanf' के परिणाम की जांच नहीं करते हैं? –