I was wondering if there was possibly a way where one could scan a variable and then compare it all in the same line (same time).
So far I tried this:
if(strcmp((scanf("create.%s",comp)),comp)==0) //Please do not mind any missed parentheses or something like that...
I know ^that doesn't work because I've tried it and it ended up with an error...
So how would one achieve such a task? Or is it impossible?
If you really really want to do that (and I see no reason to), you may do the following:
char *superScanfWithString(const char *format, char * str) {
scanf(format,str);
return str;
}
...
if(strcmp((superScanfWithString("create.%s",comp)),comp)==0)