Are there pitfalls for specific operating systems, I should know of?
There are many duplicates (1, 2, 3, 4, 5) of this question but they were answered decades ago. The very high voted answers in many of these questions are wrong today.
Methods from other (old QA's) on .sx
stat.h (wrapper sprintstatf), uses syscall
tellg(), returns per definition a position but not necessarily bytes. The return type is not
int.