Reading from files passed as command line arguements

前端 未结 3 2025
暗喜
暗喜 2021-01-21 16:15

I am trying to parse a given textfile, but so far, my program does not seem to be reading properly.

#include 


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


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-21 16:24

    argv[0] is the name of the program (./sjf in your case), so you're trying to read in your own program's executable. Use argv[1] instead to get the first real program argument.

提交回复
热议问题