I want to know what is the difference between fgets() and scanf(). I am using C as my platform.
There are multiple differences. Two crucial ones are:
fgets() can read from any open file, but scanf() only reads standard input.fgets() reads 'a line of text' from a file; scanf() can be used for that but also handles conversions from string to built in numeric types.Many people will use fgets() to read a line of data and then use sscanf() to dissect it.