Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
C Programming problem using character type scanf
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="rashiki" data-source="post: 776856" data-attributes="member: 79457"><p>Hi,</p><p></p><p>I am running into the same problem. I am starting out writing simple console programs using a cocoa project with XCode 2.5 and have been running into the same problem as you have with character variables and "while" looping. Funny thing is that if I do a "while" loop, if I set the "char" variable to 'y' for "yes" outside the loop first (so that it enters), and then use "scanf" inside the "while" loop, it will actually ask me for the letter, but just that first time. If I enter 'y' to do the loop again, it totally blows by the "scanf" the next time and then exits the "while" loop.</p><p></p><p>Have you figured anything out yet? I used an integer variable instead and used by conditional test with '0' or '1' and it doesn't blow by the "scanf" this way. Only with a character variable.</p><p></p><p>Ryan</p></blockquote><p></p>
[QUOTE="rashiki, post: 776856, member: 79457"] Hi, I am running into the same problem. I am starting out writing simple console programs using a cocoa project with XCode 2.5 and have been running into the same problem as you have with character variables and "while" looping. Funny thing is that if I do a "while" loop, if I set the "char" variable to 'y' for "yes" outside the loop first (so that it enters), and then use "scanf" inside the "while" loop, it will actually ask me for the letter, but just that first time. If I enter 'y' to do the loop again, it totally blows by the "scanf" the next time and then exits the "while" loop. Have you figured anything out yet? I used an integer variable instead and used by conditional test with '0' or '1' and it doesn't blow by the "scanf" this way. Only with a character variable. Ryan [/QUOTE]
Verification
Name this item. 🍎
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
C Programming problem using character type scanf
Top