【问题标题】:what are the alternative for win32 to alarm,bzero,bcopy when porting c code移植c代码时win32报警,bzero,bcopy的替代方法是什么
【发布时间】:2011-03-30 09:21:48
【问题描述】:

使用 Visual Studio Express 将 c 代码导入 Windows 32 位
现在我有 3 个在 windows 中找不到替代品的功能
他们是:
闹钟

复制
C win32 中的等效方法是什么?

【问题讨论】:

    标签: c winapi porting


    【解决方案1】:

    你需要挖掘的其他两个警报是:

    #define bzero(b,len) (memset((b), '\0', (len)), (void) 0)  
    #define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0)
    

    【讨论】:

    • 逗号运算符似乎没有必要,您可以将函数的结果转换为void
    【解决方案2】:

    您从哪个平台移植到 Windows?总之bzerobcopy已经贬值了很久了。

    对于 bzero:

    此函数已弃用(在 POSIX.1-2001):在 new 中使用 memset(3) 程式。 POSIX.1-2008 删除了 具体的 bzero() 的化合。

    对于 bcopy:

    此函数已弃用(在 POSIX.1-2001):使用 memcpy(3) 或 memmove(3) 在新程序中。注意 首先 memcpy(3) 和 memmove(3) 的两个参数互换。 POSIX.1-2008 删除规范 bcopy() 的。

    因此,只需修复您的代码并使用建议的替换。

    【讨论】:

      【解决方案3】:
      memcpy (output, input, size * sizeof (input[0]));
      

      而不是

      bcopy (input, output, size * sizeof (input[0]));
      

      memset(m, 0, n * sizeof (gfloat));
      

      而不是

      bzero (m, n * sizeof (gfloat));
      

      【讨论】:

        【解决方案4】:

        报警请看Win32-API函数SetTimer()

        【讨论】:

          猜你喜欢
          • 2012-11-19
          • 1970-01-01
          • 2011-03-07
          • 1970-01-01
          • 2018-03-25
          • 2018-10-09
          • 2011-01-15
          • 2012-01-27
          • 2020-10-16
          相关资源
          最近更新 更多