I can't pass strings starting with #
as command-line arguments.
Here is a simple test:
#include <stdio.h>
int main(int argc, char *argv[])
{
for (int i = 1; i < argc; i++)
printf("%s ", argv[i]);
putchar('
');
return 0;
}
If I input the arguments as follows:
2 4 # 5 6
The value of argc
is 3
and not 6
. It reads #
and stops there. I don't know why, and I can't find the answer in my copies of The C Programming Language and C Primer Plus.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…