Hi, all. I know this problem has been addressed in this forum but I am still facing some difficulties with my input.
Ok, I know that I should not mix scanf with gets but what I need to do is to ask my users to input a number of things into a file:
1) a string (e.g. a book title - I can't use scanf as it will only recognize the first word).
2) another string (e.g. publisher - same issue as above).
3) an interger (e.g. price of book)
4) a character (e.g. F - Fiction / N - Non-fiction.
I know the above strings can be accomplished using gets() but if I use scanf for my price, the input will be skipped.
There must be a way out of this problem but with what limited knowledge I have, I am stump!
Any help would be appreciated.
Thanks,
Darryl
Ok, I know that I should not mix scanf with gets but what I need to do is to ask my users to input a number of things into a file:
1) a string (e.g. a book title - I can't use scanf as it will only recognize the first word).
2) another string (e.g. publisher - same issue as above).
3) an interger (e.g. price of book)
4) a character (e.g. F - Fiction / N - Non-fiction.
I know the above strings can be accomplished using gets() but if I use scanf for my price, the input will be skipped.
There must be a way out of this problem but with what limited knowledge I have, I am stump!
Any help would be appreciated.
Thanks,
Darryl