简体   繁体   中英

How to start gvim without terminal?

I'm trying to start gvim using this line:

execl("/usr/bin/gvim", "-f", path, (char *)NULL);

however I'm getting

Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal

and I'm not sure how to solve this. I mean, I know that output is not a terminal, that's why I'm using gvim instead of just vim . It's probably something really obvious, but I just don't know.

If you forget to put the program's name as the first parameter of exec, gvim will try to open in terminal mode.

It should be:

execl("/usr/bin/gvim", "/usr/bin/gvim",
      "-f", path, (char *)NULL);

From the execl man page:

The first argument, by convention, should point to the filename associated with the file being executed . The list of arguments must be terminated by a NULL pointer, and, since these are variadic functions, this pointer must be cast (char *) NULL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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