As far as i know, a text file is treated similar to binary file except that some os's do some linefeed, carriage return translations. Text files are sometimes parsed by reading line-by-line, which, in c++, is straightforward to do (std::getline()). You have the filesize, you know when you've reached the end of file, and you can read line-by-line if you want. Thinking from a text file point of view, i don't even think '\0' is valid in it (does getline() stop at the '\0'). I guess what i'm trying to say, a text file is basically a binary file except it generally contains printable text rather than some sort of binary data and a '\0' would be considered binary data.
But how does the Scheduler actually interrupt the application when it has full control? Is there a timer that interrupts the CPU every 10ms unless it is reset, triggering some Scheduler code?
On x86, you can set up a timer interrupt to trigger every so often.
Does the OS before launching a new thread set the CPU to operate in "user mode" limiting some instructions?
On x86, most os's will set the 'ring level' to 3, limiting some cpu commands (like loading the page table, 'hlt' ing the cpu, etc., making some io ports unavailable)
How does the application allocate memory without hazard, through the memory controller?
Generally, it sends a 'syscall' irq, where when the os recieves it, it maps some memory for the application, possibly adding a page table entry.
How can the OS restrict the application to its own address space, user mode, can't the application disable "user mode" itself?
On x86, the 'kernel' sets the process to ring level 3, limiting many commands. Restricting the address space is basically done by the kernel setting up a unique page table for the process itself before handing over control to the process.
www.osdev.net may have documentation that will help you out.
header guards (or pragma once) just make sure that the header file is read one time per tu (translation unit). so if a.cpp includes it, and b.cpp includes it, and you compile a.cpp and b.cpp separately, there will be 2 instances of 'LogicContainer logic'. Simplest solution is to put 'extern LogicContainer logic' in the header file, and define 'LogicContainer logic' in some .cpp that will be linked in.