简体   繁体   English

为什么在Visual Studio 6.0中找不到errno?

[英]Why is errno not found in Visual Studio 6.0?

#include <errno.h>  
  /* compress until end of file */
  do {
       strm.avail_in = fread(in, 1, CHUNK, source);
       errno; //<-----DEBUGGER "CXX0017: Error: symbol errno not found"  
       perror("Error:");

      if (ferror(source)) //<--ferror = 32 but there is no string from perror? 
      {
         //error handling

When you build with the DLL version of the CRT (/MDd for example), errno is a macro. 当使用CRT的DLL版本(例如/ MDd)进行构建时,errno是一个宏。 Translating it to a function call to obtain the shared value of errno. 将其转换为函数调用以获得errno的共享值。 Fix it like this: 像这样修复它:

int err = errno;

so you can inspect the value of err. 因此您可以检查err的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM