I've written a small cross-platform command line application in C and would like to be able to run it in a new screen session on each platform rather than run it directly on the command line. I noticed when using vim when it is run from either the Linux or Windows command line it starts a new screen session for itself (without opening a new window, which I do not want) and returns back to the command line after exit and the screen maintains its previous state.
I've seen it often, but cannot find any clear documentation anywhere on how to do it. How is this accomplished when writing C programs? The only information I could find on this whatsoever was some articles on 'screen' in Linux, but that appears to be a shell language implementation and I'd like to stay with C if possible. I can't find anything whatsoever regarding how to achieve this in the Windows command prompt/or on the windows platform. And yet it seems common enough that I'm also wondering if I'm missing a term or don't quite understand what to search for.
I don't want to "clear" the screen in the conventional sense, as that won't allow me to return to the previous state of the command prompt as it was before the application started. I'd like it to start a new screen session in the current terminal and after exit return back to the command prompt in the state it was before the application was started, I'd like to do it across Linux and Windows platforms, and I'd like to do it in C if possible.
Any guidance on how to achieve this or where to read about how to achieve this would be great.