0

character.c:14:70: 警告:从较小的整数类型 'int' 转换为 'char' [-Wint-to-pointer-cast] sprintf(command, "erl -noshell -s program main %s -s init stop ", (char ) 输出);

当我尝试不使用指针时

character.c:14:70: warning: format specifies type 'char *' but the argument has type
      'char' [-Wformat]
    sprintf(command, "erl -noshell -s program main %s -s init stop", (char)out);
                                                   ~~                ^~~~~~~~~
                                                   %c

我想通过终端窗口的大小stty size并将其传递给我的 Erlang 程序,以便它可以正确显示文本。

#include<stdio.h>
#include<stdlib.h>

int main(void){
  system ("clear");
  int c;
  /* use system call to make terminal send all keystrokes directly to stdin */
  system ("/bin/stty raw");
  int *out;
  while((c=getchar())!= '.') {
    char command[100];
    char output[100];
    int out = system("stty size");
    sprintf(command, "erl -noshell -s program main %s -s init stop", (char)out);
  }
  system ("/bin/stty cooked");
  system ("clear");
  system ("echo ok\n");

  // return out;
  return 0;
}

我该怎么做呢?

4

0 回答 0