Thread: gets()

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    63

    gets()

    when trying to use gets() when i compile it will not allow my program to run. it says that it is dangerous and should not be used. i am using code blocks for ubuntu. is there a way around this or an alternative?

    Thanks in advanced!!

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Cprogramming.com FAQ > Get a line of text from the user/keyboard (C)

    Edit: Since you are using Linux, you might want to have a look at this function.
    Last edited by kermit; 09-12-2010 at 07:41 PM.

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    63
    whats he function called kermit? give me the name and ill google it. thanks

  4. #4
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    How about you read what is at the links I posted; Otherwise, if you can't be bothered to do that much, then I can't be bothered to type out the names of the functions.

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    63
    Becuase i do not click on links or download files! just something i dont do. Its not like ur the last guy on earth and i absolutely need you bro! If you dont want to help and be a cocky ..........hole then that is fine i do not need your help! Thank you

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    How the hell do you function on the Internet if you "do not click on links or download files"??? How did you manage to get here? How did you manage to download Code::Blocks? kermit has 1,402 posts, you think he's going to steer you wrong? Please. Don't be ridiculous.

  7. #7
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Quote Originally Posted by codecaine_21 View Post
    Becuase i do not click on links or download files! just something i dont do. Its not like ur the last guy on earth and i absolutely need you bro! If you dont want to help and be a cocky ..........hole then that is fine i do not need your help! Thank you
    One would wonder, if you don't click on links, how you even got to this site?

  8. #8
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    when trying to use gets() when i compile it will not allow my program to run. it says that it is dangerous and should not be used. i am using code blocks for ubuntu. is there a way around this or an alternative?
    I doubt that it won't allow you to run program.
    What's wrong with clicking on a link?
    c-faq12.23 why gets() should not be used and alternative function.

  9. #9
    Registered User
    Join Date
    Sep 2010
    Posts
    63
    it wont let me run the program because it says it is dangerous but the reason i dont click on links people give me is a personal reason but i understand y it shouldnt be used i just dont understand y code blocks wont allow me to run it. and i am hoping for an alternative

  10. #10
    Registered User
    Join Date
    Sep 2010
    Posts
    63
    me not clicking on links people give me is my issue but there was no reason to come off with an attitude lol sorry if i came off wrong, sorry kermit, sorry to the forum and just please understand i will not click a link given by another! an dif this is a problem let m eknow! but if not then help me out please

  11. #11
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Kermit's link let to information about "getline".

    If you hover the mouse over the links your browser should show you the URL they're pointing to... All you need to do is exercise a little wisdom and not click on linkes to harmful files. We're here to help, it's probably not a very good idea to blow us off.

  12. #12
    Registered User Char*Pntr's Avatar
    Join Date
    Sep 2007
    Location
    Lathrop, CA
    Posts
    198

    Exclamation

    How To Ask Questions The Smart Way <--- "How to ask questions the smart way"

  13. #13
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    266
    You know, web pages are downloaded to your system. You had to get to this page by clicking links. Using google, you are clicking on links so none of this makes since.

    Anyway, you could use the "fgets()" function or "scanf()" but I wouldn't use the latter for strings.

    EDIT: I use Code::Blocks and I am able to use gets() without a warning.

  14. #14
    Registered User
    Join Date
    Sep 2010
    Posts
    63
    you know what yall are here to help me yall are right not cause harm im sorry for the trouble i have caused and i am gonna start with kermits link and trust in the site that yall are going to guide me so my sincere apologies again!

  15. #15
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    266
    Heh, the first link just directs you to a page on THIS website. You are in good hands.

Popular pages Recent additions subscribe to a feed