I want to compare what I get on the command line in winmain with an if statement.. I am getting a beginers error but I don't have an example to use to fix it.. cannot convert from 'const int' to 'char *' in this line if (__argv[1] = 'file'){};
I am very lost with this error and any help would be apreaceated
I am very lost with this error and any help would be apreaceated
Code:
int WINAPI WinMain(HINSTANCE hInstance, //handle to current instance
HINSTANCE hPrevInstance, //pointer to the previous instance
LPSTR lpCmdLine, //pointer to the command file
int nCmdShow) //show state of the window
{
//
HWAVEOUT hWaveOut; //handle to sound card output
WAVEFORMATEX WaveFormat; //The sound format
WAVEHDR WaveHeader; //Wave header for our sound data
char Data[BUFFERSIZE]; //sound data buffer
HANDLE Done; // Event handle that tells us the sound has finished being played.
// This is a real efficient way to put the program to sleep
//The sound card is processing the sound buffer
double x;
int ii;
int i;
int FREQUENCY;
FILE * pFile; //this is set up to read from a file
char string [100]; //this is the file we are reading
struct wordd line[20]; //create an array of 20 words
char * pch; //from strtok example
//if command line is file
if (__argv[1] == "file")
{
pFile = fopen (__argv[2] , "r"); //second argument is filename
if (pFile == NULL) perror ("Error opening file");
else {
fgets (string , 100 , pFile); //get a line from a file
pch = strtok (string," "); //split string into token seperated by a space
i = 0; // iterator starts at 0
while (pch != NULL) // while there is something to split
{
i++; //this indicates where you are in the loop not used here but for more advanced synths
// line[i].word = pch; //put pch in place in the line for this synth freq is first word
ii = atoi(pch);
pch = strtok (NULL, " "); //grab next word
//I will need to have an array of pch to do more paremeters in a synth.. redo the line maybe..
playsound(ii);
}
//ii = atoi(pch); //convert line to a number using atoi
// playsound(ii); //play the sound..
//puts (string); prints line I think
fclose (pFile);
}
}
if (__argv[1] = 'file'){};
//playsound(int freq)}
if (isdigit(__argv[1][1])) //if this is a number play the frequency
{
i = atoi(__argv[1]);
playsound(i);
}
//if
//string = __argv[1];
//if (__argv[1] = 'file'){};
//** Release our event handle **
return FALSE;
}
Comment