Cómo utilizar sscanf



/*                                                               */
/*   File name : entrada.c                                 */
/*                                                               */
/*   Copyright (c) 2006 CASIO COMPUTER CO., LTD.                 */
/*                                                               */
/*****************************************************************/
#include "fxlib.h"
#include "stdio.h"

//****************************************************************************
//  AddIn_main (Sample program main function)
//
//  param   :   isAppli   : 1 = This application is launched by MAIN MENU.
//                        : 0 = This application is launched by a strip in eACT application.
//
//              OptionNum : Strip number (0~3)
//                         (This parameter is only used when isAppli parameter is 0.)
//
//  retval  :   1 = No error / 0 = Error
//
//****************************************************************************

/* Usando sscanf */ 
int AddIn_main(int isAppli, unsigned short OptionNum)
{
    unsigned int key;
char s[] = "31298 87.375";
int x;
float y;

    Bdisp_AllClr_DDVRAM();

sscanf (s, "%d%f", &x, &y);    

locate(1,3);
    Print((unsigned char*)"Valores almacenados");

locate(1,4);
    Print((unsigned char*)"en el arreglo s son:");

sprintf (s, "Integer: %6d",x);
locate(1,5);
    Print((unsigned char*) s);

sprintf (s, "Float: %8.3f", y);
locate(1,6);
    Print((unsigned char*) s);

    
    while(1){
        GetKey(&key);
    }


    return 1;
}




//****************************************************************************
//**************                                              ****************
//**************                 Notice!                      ****************
//**************                                              ****************
//**************  Please do not change the following source.  ****************
//**************                                              ****************
//****************************************************************************


#pragma section _BR_Size
unsigned long BR_Size;
#pragma section


#pragma section _TOP

//****************************************************************************
//  InitializeSystem
//
//  param   :   isAppli   : 1 = Application / 0 = eActivity
//              OptionNum : Option Number (only eActivity)
//
//  retval  :   1 = No error / 0 = Error
//
//****************************************************************************
int InitializeSystem(int isAppli, unsigned short OptionNum)
{
    return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}

#pragma section


No hay comentarios:

Publicar un comentario