Used argv[1] instead of argv[0] because argv[0] means the script name not the first parameter.