在 Linux 系统调用中的 C 程序中出现错误 stray ‘\342’ stray ‘\210’ stray ‘\222’

Error with stray ‘\342’ stray ‘\210’ stray ‘\222’ in C program in Linux system call

我正在尝试从 Robert Love 的书 Linux 系统编程,第 2 版(第 60-61 页)中做一个关于轮询系统调用的示例。我复制并粘贴了 Code::Blocks on Ubuntu 14.04 (Trusty Tahr) 中的示例代码并尝试对其进行编译,但我的代码中出现与杂散 '/342' '/210' 和 '/222' 相关的错误。

以下是代码:它在检查 if(ret == -1) 的第 18 行抛出错误

#include <stdio.h>
#include <unistd.h>
#include <poll.h>

#define TIMEOUT 5

/* Poll timeout, in seconds */
int main (void)
{
  struct pollfd fds[2];
  int ret;

  /* Watch standard input for input */
  fds[0].fd = STDIN_FILENO;
  fds[0].events = POLLIN;

  /* Watch standard output for ability to write (almost always true) */
  fds[1].fd = STDOUT_FILENO;
  fds[1].events = POLLOUT;

  /* All set, block! */
  ret = poll(fds, 2 , TIMEOUT*1000);

  if (ret == −1) {
    perror("poll");
    return 1;
  }

  if (!ret) {
    printf ("%d seconds elapsed.\n", TIMEOUT);
    return 0;
  }

  if (fds[0].revents & POLLIN)
    printf ("stdin is readable\n");

  if (fds[1].revents & POLLOUT)
    printf ("stdout is writable\n");

  return 0;
 }

错误是:

/home/eelab/sysprog/pollex/main.c|18| error: stray ‘2’ in program|
/home/eelab/sysprog/pollex/main.c|18| error: stray ‘0’ in program|
/home/eelab/sysprog/pollex/main.c|18| error: stray ‘2’ in program|

现在,我在 Stack Overflow 上回答了类似的问题,他们提到了 ASCII 字符(如引号“”)的转换可能存在的问题。但是,我又重写了 IDE 中的所有引号。但它仍然在检查 if(ret == -1 ) 的行上抛出相同的错误。

上有无法打印的
if (ret == −1) {

替换为-