friend told me scanf is bad and told me to i need fgets + sscanf to replace it


this is what i have now
Code:
if(scanf(",%ld", &c) != 1 )
	    printError=1;
is this the replacement?
Code:
if (fgets(buffer, BUFSIZE, stdin) != 1){
    sscanf(buffer,"l%ld,%ld", &input1, &input2);
    printError=1;