Try having a look at the manual page (man gcc). Be warned, there's a lot of it.
Are you sure the code there is exactly as in the textbook though, and there isn't a space or something between the two %d's though? 'Cause as it is, what you're asking the system to read is two integers, with nothing between them? So how does it know where one number ends and another starts.
For example, given the input 123, is this 12, then 3, or 1, then 23?
Of course, it is possible that I'm on completely the wrong track here.
Just to clarify, what do you mean when you say "simple text files will sometimes work without a problem"?
Anyway, I hope this helps you.