/*!
 * \brief This function performs similarly to the scanf function of 'C'.
 * 
 * \param[in] file_ptr The stream to scan from.
 * \param[in] fmt_ptr  The format string to use when scanning.
 * 
 * \return Number of input items converted and assigned.
 * \return IO_EOF  
 */ 
_mqx_int _io_fscanf
   (
      MQX_FILE_PTR     file_ptr,
      const char  *fmt_ptr, 
      ...
   )
{ /* Body */
   char    temp_buf[IO_MAXLINE];
   va_list ap;
   _mqx_int result;
   
#if MQX_CHECK_ERRORS
   if (file_ptr == NULL) {
      return(IO_EOF);
   } /* Endif */
#endif

   va_start(ap, fmt_ptr);
   /* get a line of input from user */
   if (_io_fgetline( file_ptr, temp_buf, IO_MAXLINE) == IO_EOF) {
      return(IO_EOF);
   } /* Endif */
   result = _io_scanline( temp_buf, (char *)fmt_ptr, ap );
   va_end(ap);
   return result;

} /* Endbody */
Exemple #2
0
_mqx_int _io_scanf
   ( 
      /* [IN] the format string to scan with */
      const char _PTR_ fmt_ptr, 
      ...
   )
{ /* Body */
   char    temp_buf[IO_MAXLINE];
   va_list ap;
   _mqx_int result;
   
   va_start(ap, fmt_ptr);
   temp_buf[0] = '\0';
   if (_io_fgetline(stdin, temp_buf, IO_MAXLINE) == IO_EOF) {
      return(IO_EOF);
   } /* Endif */
   result = _io_scanline(temp_buf, (char _PTR_)fmt_ptr, ap);
   va_end(ap);
   return result;

} /* Endbody */