我需要在Wince平台上执行一些文件操作。与模拟器相比,设备的文件路径不同。因此,我需要根据环境选择文件,如下所示。

#if defined(WINCE_EMULATOR) //This macro is just for illustration
   #define path ".\Storage Card\\1.txt" //Emulator configuration
#else
   #define path "\\My Documents\Storage Card\\1.txt" //Device configuration
#endif

是否有宏可以区分Wince Emulator和Wince设备?

有帮助吗?

解决方案

没有宏可以检查一下,也不能 - 编译器不知道您要运行什么目标。您必须使用类似的操作时间进行运行时间检查 SystemParameterSinfo 使用Spi_getoeMinfo并查找模拟器特定文本(IIRC它返回类似“ Microsoft DeviceEmulator”)。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top