Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!hela!widener!iggy.GW.Vitalink.COM!lll-winken!aunro!apss!jhp From: jhp@apss.ab.ca (Herbert Presley) Newsgroups: comp.lang.c Subject: problems with scanf() and gets() Message-ID: <2759@apss.apss.ab.ca> Date: 6 Jun 91 05:07:02 GMT Distribution: comp Organization: Alberta Public Safety Services Lines: 28 I am a new C programmer and I've been trying to get an answer through the net for the following problem. Unfortunately, my postings don't seem to be getting through for some reason. I kinda feel intimidated because, like most new programmers, I am probably asking a question that has a VERY simple response, and I can't help but feel that it's a problem that I am creating by my lack of knowledge. For your information, I run a Turbo C compiler on an XT (true) compatible. scanf() and gets() will not accept keyboard input in the same program if scanf() is used first. I am using scanf() to accept an integer from the keyboard and gets() to accept a string. Because scanf() aborts input at the first whitespace, you cannot enter a sentence string (or, is this something I am doing wrong because of my inexperience)? So in instances where you are attempting to enter a formatted integer variable and a string in the same program, I find that using scanf() first makes gets() skip the wait for keyboard input. Unfortunately, I have no mentor in my world who knows very much about C. I began with C through a couple of courses at our local Technical College and they don't seem to offer a great deal of ongoing support. ___________________________________________________________________________ email : jhp@apss.ab.ca mail : c/o APSS, 10320 - 146 St., Edmonton, Alberta, Canada T5N 3A2 phone : (403) 451-7151