我需要能够判断我的命令行中的最后一个参数是否用双引号括起来。如果它在双引号中,我将其视为字符串。如果不是,我需要把它当作一个文件来打开并获取字符串。默认情况下,Argv 会抓取双引号字符串并去掉引号,所以我想不出解决这个问题的方法。
伪代码是这样的......
if(argv[argc-1] was called with surrounding double quotes){
//handle as string (I already have code to do this)
}
else{
//handle as filename (I already have code to do this)
}