Hi everyone,
I am writing a program which plays morse code, using the system speaker, for linux. I have the program almost working, however I have one problem, which I can't quite solve. When comparing the contents of argv[i], the provided comparison never matches. I believe this is because the argument also has an invisible character attached
1 2 3 4 5 6 7
for(int i=1;i<argc;i++)
{if ((argv[i]=="-dl")||(argv[i]=="--dashlength"))
{dashlen=atoi(argv[i+1]);}
if ((argv[i]=="-Df")||(argv[i]=="--dotfreq"))
{dotfreq=atoi(argv[i+1]);}
if ((argv[i]=="-df")||(argv[i]=="--dashfreq"))
{dashfreq=atoi(argv[i+1]);}}
This is a small part of the code. Itcode compiles fine, but it won't work. In the meantime, I have used strstr to find the string in argv, and it works fine, however this is not pedantic enough. This is a simple problem, I know, but I have spent hours trying to figure it out. What should I add?