如何在 C 中将 X'221A 参数传递给 int main(int argc,char *argv[])

How to pass X'221A argument to int main(int argc,char *argv[]) in C

各位程序员,有谁知道我应该如何传递带有 "special" 字符的参数?我收到一个错误:

sh: 1: Syntax error: Unterminated quoted string

这就是我如何调用我的程序试图将 X'221A 放入我的 argv

./program X'221A

'是伯恩shell的特殊字符。你需要逃避它。

./program X\'221A

以下也适用:

./program "X'221A"