Parsing '?' in getopt

前端 未结 3 829
执念已碎
执念已碎 2021-01-17 05:48
void display(char * str){
   printf(\"%s: Missing file\\n\", str);
}

int main(int argc, char **argv)
{

    int longIndex, opt = 0;
    const char *optString = \"h?         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-17 06:08

    const char *optString = "h?";

    Above line replace with following line

    const char *optString = "h\?";

    this is the literal of question mark in C language

提交回复
热议问题