Results 1 to 4 of 4

Thread: Add scanf without newline

  1. #1
    Join Date
    Apr 2009
    Posts
    87

    Add scanf without newline

    I am trying to make a small program to get back to C program and I wonder if it is possible to scanf without a newline afterwards.

    Here is a example:

    Code:
    printf ( "\ n We have P (x) ="); 
      scanf ( "% ld", & a); 
      printf ( "x ^ 2 +"); 
      scanf ( "% ld", & b); 
      printf ( "x +"); 
      scanf ( "% ld", & c);

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Add scanf without newline

    The function scanf is the input analog of printf, providing many of the same conversion facilities in the opposite direction.\n Feeds a newline to the computer, the equivilant of hitting "enter"If you have multiple format specifiers within the string argument of scanf, you can input multiple values.

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    Re: Add scanf without newline

    Unfortunately the entries are buffered in a system to make the system buffer entry empties at the reception of the character 'CR' (Carriage Return or ENTER ) In short if you do not want to issue must make readings much lower level. /n :This feature allows you to come 'play' the keyboard directly rather than reading the buffers.

  4. #4
    Join Date
    Dec 2008
    Posts
    177

    Re: Add scanf without newline

    Then do not use the "enter" validation scanf, but space for example.

    Try this:

    Code:
     scanf ( "% [^] d", & a);

Similar Threads

  1. Solve numerically erf(x) and alternative to scanf
    By Ricky58 in forum Software Development
    Replies: 4
    Last Post: 26-10-2009, 12:46 AM
  2. How to create javascript dump newline
    By Broot in forum Software Development
    Replies: 3
    Last Post: 30-07-2009, 12:01 PM
  3. .net compact textbox newline
    By Shashee in forum Software Development
    Replies: 3
    Last Post: 04-06-2009, 07:42 PM
  4. How to avoid problems with scanf?
    By Zool in forum Software Development
    Replies: 3
    Last Post: 14-05-2009, 07:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,805,219.03246 seconds with 16 queries