Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
long file names(continued)
I am checking argc because the first argument is fixed. The console aplication is called by another application. The calling application checks that there should be two parameters being passed to the console application. argv is a fixed parameter and argv is the filepath. If this is not the case then the calling application does not call the executable. That is why i am checking argc and i cant control the input argument to be in qoutes.
In reply to tsagld who wrote:
Realize that your code only works if the path is the last argument in the list. Besides that, you have to allocate space for cdrpath before you know how much space is needed. That's vulnerable to buffer overflows.
As I stated before, it is better to pass the path between double quotes. Stober gave an example.
0 · ·