check OS type

How do you check what OS you are on via C++. I came across a few answers say to check the environmental vars, the only env vars i saw that both linux and windows have in common is PATH. So I guess i could check the path for first char as / or C, and then execute uname for linux to get detailed info, etc. But there seems there must be a better accurate way?
Topic archived. No new replies allowed.