Determine if Linux or Windows in C++

后端 未结 6 1876
忘了有多久
忘了有多久 2021-02-04 00:40

I am writing a cross-platform compatible function in C++ that creates directories based on input filenames. I need to know if the machine is Linux or windows and use the appropr

6条回答
  •  感情败类
    2021-02-04 01:04

    One of the most used methods to do this is with a pre-processor directive. The link is for C but they're used the same way in C++. Fair warning, each compiler & OS can have their own set of directives.

提交回复
热议问题