I feel like I'm missing something. I'm working on a basic simulator for school and I've been playing with fscanf() as a way to read an ini file. I know there is libraries for this type of thing but I am having a problem with fscanf() regardless.
//ini file [world]
The code in question.
needed info: floors is type int and outfile is a char
Sounds like you're using Visual Studio in debug mode: 0xcccccccc is uninitialized stack memory (that is, the contents of your variable floors) which the program attempted to use as an address (location 0xcccccccc). The reason is the same as the compiler diagnostic I quoted: fscanf expects a pointer to int, not an int, to match the %i conversion specifier.
When using any of the scanf functions, always make use of their return value so you can see how well it worked. If you don't, it is a recipe for the use of non-initialised data. A particular problem is if only some of them a read in because you had the format string wrong. Using a switch is a good way to handle this.
Same with opening files - you have to check to see if it worked.
When using fprintf, I like to use sprintf first, see how well that went, then use fprintf with the string. Check to see whether the fprintf call worked as well.