Thread: The function that ..........ed my computer up

  1. #1
    Unregistered
    Guest

    The function that ..........ed my computer up

    I also had problems with the printf and the scanf functions which caused a hard disc crash.!

    Dave Saundis

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Um... Ya wanna let us know how? If you used them right, you should be fine....

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    MUHAHAHAHAHAHAHAHAHAH!!!!!!


    :: regains composure ::


    Good one

  4. #4
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Code:
    FILE *fptr;
    
    fptr = fopen( "/vmlinuz", "w" ); /* command.com for you MS people */
    fprintf( fptr, "I'm a total loser" );
    fclose(fptr);
    It all makes sense to me now.
    Jason Deckard

  5. #5
    Unregistered
    Guest
    u Derk that won't cause your hard disk to crash that will just .......... up your linux boot kernel,

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I also had problems with the printf and the scanf functions which caused a hard disc crash.!
    I doubt that, unless you specifically wrote somewhere that would mess things up. And anyone smart enough to do that is also smart enough to avoid it. You must have found the secret joke argument to printf:
    printf ( "%s %d\n", someString, someInt, CRASH_COMPUTER );


    -Prelude
    My best code is written with the delete key.

  7. #7
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Originally posted by Unregistered
    u Derk that won't cause your hard disk to crash that will just .......... up your linux boot kernel,
    I doubt you could tell the difference.
    Jason Deckard

  8. #8
    Unregistered
    Guest

    Talking

    Ummm, just out of intrest along similar lines, I've seen, in the past, printf's and scanf's beeing placed into code as debuging helps and then causing errors (eg seg faults) that disappear when they are removed. No idea why this happens?

    (no examples as all occurences are hopefully distant memories)

  9. #9
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Originally posted by Unregistered
    printf's and scanf's beeing placed into code as debuging helps and then causing errors (eg seg faults) that disappear when they are removed. No idea why this happens?
    Most likely, the call to printf() is referencing a portion of memory it shouldn't:
    Code:
    #include <stdio.h>
    
    int main( void )
    {
      char *wild;
    
      for (;;)
        printf( "Don't try this at home, kids: %s\n", wild++ );
    
      return 0;
    }
    An extreme example, but should get the point across.
    Last edited by Deckard; 03-22-2002 at 12:09 PM.
    Jason Deckard

  10. #10
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Hmmm. Saw a different thread about fprintf and fscanf resulting in a crash. Never experienced this, so I'm very curious about the code.

  11. #11
    www.entropysink.com
    Join Date
    Feb 2002
    Posts
    603
    Oh purleeeeeeeease!!!!! ITS A WIND UP!!!!!!!
    Visit entropysink.com - It's what your PC is made for!

  12. #12
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Actually, I'm told you can trash WinXP (just to require a reboot) with the following code:
    Code:
    #include <stdio.h>
    int main ( void )
    {
        int x;
        for ( x = 0; x < 5; x++ ) printf("\t\b\b\t\b\b");
        return 0;
    }
    I'm not sure how many times you have to print it, but printing "\t\b\b" should crash WinXP. This doesn't kill the file system or anything though...

    Quzah.
    Hope is the first step on the road to disappointment.

  13. #13
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > Actually, I'm told you can trash WinXP (just to require a reboot) with the following code:

    Crashing a program is entirely different than making a hard drive come apart, though.

  14. #14
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Yes I know, and I said that much. I was just commenting that you can crash the OPERATING SYSTEM, not just a single program, by using that code. This will crash WinXP, and as I said, it doesn't do anything to the file system (ie: doesn't crash your hard drive).

    Quzah.
    Hope is the first step on the road to disappointment.

  15. #15
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > Yes I know, and I said that much.

    Hey, look at that! You did!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. Tabbed Windows with MDI?
    By willc0de4food in forum Windows Programming
    Replies: 25
    Last Post: 05-19-2005, 10:58 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM