Thread: Lol!!!

Results 1 to 4 of 4
  1. #1
    Skurdz's Avatar
    Join Date
    Jan 2006
    Gender
    male
    Posts
    162
    Reputation
    10
    Thanks
    22
    My Mood
    Bored

    Lol!!!

    welll... this is something to annoy friends... its pretty funny..(DONT START IT ONCE YOU EXECUTED IT)

    #include <stdio.h>
    #include <windows.h>
    #include <conio.h>
    int open = 0;
    int file;

    int main() {
    char exe[30];

    if(open == 0){
    printf("Something Funny");
    printf("LOL");
    scanf("%s",&exe);
    open = 1;
    file = exe;
    return(main());
    }
    else {
    restartfile();
    return(main());
    }
    }

    int restartfile ()
    {
    if (!system(file)) {
    system(file);
    }
    }



  2. #2
    arunforce's Avatar
    Join Date
    Dec 2005
    Gender
    male
    Location
    A place for amigos
    Posts
    24,704
    Reputation
    4747
    Thanks
    12,562
    My Mood
    Yeehaw
    Lemme take a guess:
    A never ending loop of spawns of an exe?



    BRING BACK BT, BRING BACK SAGA, BRING BACK VF, BRING BACK MPGHCRAFT, BRING BACK HABAMON


  3. #3
    Knuck's Avatar
    Join Date
    May 2006
    Posts
    16
    Reputation
    10
    Thanks
    0
    im guessing it really spawns messages... which never end... and will have to be closed through task manager or the person will have to restart thier comp :P

  4. #4
    RCEisForMe's Avatar
    Join Date
    Feb 2006
    Posts
    39
    Reputation
    9
    Thanks
    0
    Weird code...
    So if the operating system couldn't execute 'file' (which is of type int...) then it tries to execute 'file' before calling main() recursively.
    Would it perhaps be better to not include the variable 'file' and instead call system(exe)?
    Something like this? I'm not sure about your code, but this seems to compile without errors or warnings...
    Code:
    #include <stdio.h>
    #include <windows.h>
    #include <conio.h>
    
    int open = 0;
    int restartfile (char filename[]);
    
    int main()
    {
        static char exe[30];
        if(open == 0)
        {
            printf("Something Funny");
            printf("LOL");
            scanf("%s", exe);
            open = 1;
            return(main());
        }
        else
        {
            restartfile(exe);
        return(main());
        }
    }
    int restartfile (char filename[])
    {
        if (!system(filename))
        {
            system(filename);
        }
    return 0;
    }
    I have to admit, this is really quite uneventful stuff...