Talk:Scanf

message: And the usage? Do you have to press enter after setting the value? -212.149.219.87 14:57, 15 May 2007 (UTC)
replies: text: That should be answered here, as a property of unix stdin--190.31.123.176 (talk) 04:11, 31 July 2008 (UTC)
thread_title: Untitled

message: The text doesn't explain why (counter-intuitively) %u accepts a negative value to an unsigned integer.  "−" being optional is irrelevant; if the input string doesn't contain "−", you have the normal case of specifying a non-negative integer.  The article on strtoul() doesn't explain either, hence my tags. -- Regregex (talk) 15:37, 15 January 2011 (UTC)
thread_title: Acceptance of negative values by %u

message: — Preceding unsigned comment added by 98.108.219.226 (talk • contribs) 18:27, 25 February 2010
: How do you know? ;) What should and what shouldn't ... it's a slippery slope; a wide grey line. .. but yeah. You're right :)  Stevebroshar (talk) 09:32, 13 April 2024 (UTC)
thread_title:  This page so does not belong in Wikipedia 

message: Does "%%" skip leading whitespace? That is, is it equivalent to " %%" or "%*1[%]"? What is the way to match a character class equivalent to a single caret (not "^" but a potentially unlimited string of "^")? Something like "%[^]" doesn't work because the character class isn't closed. 130.101.140.16 (talk) 17:04, 19 April 2011 (UTC)
thread_title:  scanf edge-cases 

message: The unsourced claim in section security does not work under gcc4.6 : the text implies that
 scanf("Please enter a value %d",&n);
would output something like this while waiting for an integer
 Please enter a value 
However, the following code, compiled with gcc -Wall -Werror -ansi -pedantic
 #include <stdio.h>
 int main(){
     int d = 0;
     scanf("enter integer: %d", &d);
     printf("entered integer: %d\n", d);
     return 0;
 }
gives
 $ ./a.out
 10
 entered integer: 0
 $ ./a.out
 enter integer: 10
 entered integer: 10
That is, you must enter 'enter integer ' before your actual input for it to work.
Since the hypothesized behaviour does not seem to be widely implemented, i'm removing that claim (which also has nothing to do in the security section).
Je ne détiens pas la vérité universelle (talk) 22:28, 7 February 2012 (UTC)
thread_title:  scanf unsourced claim 

message: "As scanf is designated to read only from standard input, many programming languages with interfaces, such as PHP, have derivatives such as sscanf and fscanf but not scanf itself."
This has nothing to do with interfaces being present in the language or not.  — Preceding unsigned comment added by 24.30.53.212 (talk) 17:10, 20 February 2012 (UTC)
thread_title:  This makes no sense 

message: A section mentioning functions such as atof(3), atoi(3), atol(3), strtod(3), strtoul(3) might be a good addition.  — Preceding unsigned comment added by 75.154.106.91 (talk) 15:55, 13 January 2013 (UTC)
thread_title:  Alternatives 

message: The redirect %d has been listed at redirects for discussion to determine whether its use and function meets the redirect guidelines. Readers of this page are welcome to comment on this redirect at  until a consensus is reached.  Nickps (talk) 14:00, 18 March 2024 (UTC)
thread_title:  "[[:%d]]" listed at [[Wikipedia:Redirects for discussion|Redirects for discussion]] 

message: The redirect Format string has been listed at redirects for discussion to determine whether its use and function meets the redirect guidelines. Readers of this page are welcome to comment on this redirect at  until a consensus is reached.  Nickps (talk) 14:00, 18 March 2024 (UTC)
thread_title:  "[[:Format string]]" listed at [[Wikipedia:Redirects for discussion|Redirects for discussion]]