简体   繁体   中英

Linux command inside C code: /* treat as comment?

In C, I want to run linux command. Namely,

int status;
status=system("lftp ftp://192.168.1.1 -e "mget -E /2015/Date*/*Snap/*.csv");

The * above is wildcard matching.

The C compiler thinks this is comment: /* and */

How do modify my call do the C compiler won't think this is comment.

Use the \\ character to escape problematic characters:

int status;
status = system("lftp ftp://192.168.1.1 -e \"mget -E /2015/Date*\/*Snap/*.csv\"");

Also, your original code had mismatched double-quote characters. You have to close both the inner and outer set.

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