A few questions
Hey everybody!
Just a few quick questions:
-what is the difference between the scanf function and the fgets function?
-what is the difference between the printf function and the sprintf function?
-what is the difference between the malloc function and the calloc function?
-what is feof, how do I use it?
-what is HINSTANCE (I know it's a handle, but what does It do)?
Thanks in advance!
Forum Rules/Features
Welcome to the WiBit.net forums! Check out our terms and features:
Hot Topic(s)
Annoy your friends
Is this something you think someone else would enjoy? Is it not for you, but do you know someone who is down with this type of content? Well share away:
Tweet
The Blog
Don't Let XML Make You a Cheater
This blog is a reminder that cheating in software development can get you into big trouble. Sometimes developers get really really lazy, OR are pressured to write something using overly simplified data structures. Almost every time this happens you are bitten in the butt! Sometimes the problems show up immediately and other times it may take months or years (especially in integrated systems).
- 1 of 78
- ››








Watch the videos. All your answers are given in there.
- scanf & fgets are both used for taking user input, but fgets is considered to be more safe because you can specifiy the size of the data that can be accepted. Using scanf doesn't provide limitations on how much data the user can enter thus exposing your program to buffer overflow vulnerabilities.
- printf will send the data to output buffer to be displayed on the screen while sprintf will move the formatted string into the variable(array) specified as destination.
- malloc is used to allocated dynamic memory for a single variable while calloc is used to allocate memory for array.
- EOF is End Of File character that signifies the position where the file contents are over. feof is the function which returns true when EOF character is encountered in the file and is used as a signal to stop reading the file. For usage, I strongly recommend you view the File IO video. It must be covered there.
- HINSTANCE is a handle to a another executable where the resource (in which you're interested) is located.