1

我在 hp-nonstop(tandem) 上尝试用 C 语言做一些事情,我的任务是等待某个时间。

我尝试使用

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main()
{
   int i;
   for(i=0;i<10;i++)
   {
     printf("Something");
     sleep(5);
     printf("Something");
     fflush(stdout);
    }
 }

编译没有问题,

运行时它给出ABENDED: 每次不同的编号。

4

1 回答 1

3

sleep()从监护人环境调用的结果是未定义的。这可能会导致您提到的 ABEND。如果你想在 Guardian hp-nonstop 环境中等待一段时间,你应该调用DELAY(). 它需要厘秒作为参数。因此,如果要添加 5 秒的延迟,则应将其称为DELAY (500). 您还需要包含标题#include<cextdecs(DELAY)>

于 2021-09-25T18:40:45.017 回答