Thread: Bypassing Scanf, Gets,......

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    1

    Bypassing Scanf, Gets,......

    Code:
    while(1)
    {
         char msg[128];
         scanf("%s", &msg); // or gets(&msg)
         printf("Bypassed");
    }
    hi there,

    From the code above I wish enqire that it is possible to bypass scanf() or gets() function as mentioned on the code above and reach prinf() function instead with input or key in any value? thanks you and if can you guys show me the code? because i need to bypass scanf() or gets() is to capture some incoming information like listening to incoming messsage from another computer. thanks you in advance

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    kiddo
    Join Date
    Sep 2005
    Posts
    8
    dude wil u b more specific as to wat u want. i dont understand ur request

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Of course it's possible to bypass any line of code!
    Code:
    while(1)
    {
         char msg[128];
         //scanf("%s", &msg); // or gets(&msg)
         printf("Bypassed");
    }
    Easy, huh?

    Oh, by the way: http://www.catb.org/~esr/faqs/smart-questions.html
    If you understand what you're doing, you're not learning anything.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Perhaps they're looking for

    Code:
    printf ( "You have 5 seconds to answer..." );
    if ( someMagic() ) {
      printf( "Nice shooting tex" );
    } else {
      printf( "Too late" );
    }
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    Perhaps you need to use threading? Both boost (C++) and SDL (C or C++) provide portable threading libraries if you don't have one with your compiler. Threading is when two segmets of code are being executed at the same time. This is usually sugested if you need input from two sources simultaniously (sp?) (IE console and network).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. scanf() consideres useless
    By Snafuist in forum C Programming
    Replies: 15
    Last Post: 02-18-2009, 08:35 AM
  2. Replies: 2
    Last Post: 02-20-2005, 01:48 PM
  3. scanf issue
    By fkheng in forum C Programming
    Replies: 6
    Last Post: 06-20-2003, 07:28 AM
  4. Scanf and integer...
    By penny in forum C Programming
    Replies: 3
    Last Post: 04-24-2003, 06:36 AM
  5. scanf - data is "put back" - screws up next scanf
    By voltson in forum C Programming
    Replies: 10
    Last Post: 10-14-2002, 04:34 AM