How can i manage to open a file and read some fixed (lets assume n) lines of ASCII code, and after that switch to reading BINARY from the same file starting with the n+1 line in C++?
You can't change the mode without reopening because the fstream uses system calls to open files which in turn do not allow a mode change. You can use tellg / seekg to save and later restore the reading position, respectively.