mercredi 13 juillet 2016

i'm a programming noob, i got this issue with if-else

#include <stdio.h>
#include <stdlib.h>

//CALLBACKS
void infoCallback(){
    system("cheese");
}
void wgetCallback(char *website){
    if(website == NULL) printf("\nSITIO WEB NO INGRESADO!\n");
    else{
        printf("%s \n", website);
        system("echo making wget success");
    }
}

int main(int argc, char *argv[]){
    printf("\tAUTO-BASH\n");

printf("%s \n", argv[1]);

if(argv[1] == "-w"){
    wgetCallback(argv[2]);
}
else if(argv[1] == "-i"){
    infoCallback();
}
else{
    printf("\nsos un noob\n");
}
}

it doesn't do what i want.... if i write -w, it go to else. ... i want to make a switch(any type){ case "??": but i don't know why i couldn't do this.

Aucun commentaire:

Enregistrer un commentaire