If I build this rename the .exe as xeta.exe on the desktop and run it directly the output says:
1
C:\Users\HAS111\Desktop\xeta.exe
However, if I actually use a command prompt to run this file on the desktop by only entering xeta and pressing enter once the directory in command line is set to desktop, all it prints is
I am using windows, actually for a long time I thought I could just use the argv[0] to get the program name and path by just reading from end of string backwards to first back-slash character.
However, when I searched on google I found that people are using some OS specific API calls to get program directory name. It was confusing. Now I understand why they don't just use the argv[0].