C/stdio.h/gets


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Перейти к: навигация, поиск

gets: reads characters from stdin

    
//Header file:     #include <stdio.h>  
//Declaration:     char *gets(char *str); 
//Return:          a null pointer on failure. 
  
  #include <stdio.h>
  #include <stdlib.h>
  int main(void)
  {
    char fname[128];
    printf("Enter filename: ");
    gets(fname);
    printf("%s \n", fname);
    return 0;
  }
         
/*
Enter filename: 321
321
*/