Ciao
devo moficare un programma in C.
tenendo presente che non sono un genio della programmazione........quindi da sola non ce la faccio.
Devo fare in modo che venga richiesto l'inserimento di più causali......fino a quando l'operato non clicca un tasto da tastiera per bloccare l'inserimento e passare allo stap successivo il salvataggio utente.
qualcuno mi può dare una mano a buttare giù il codice ??????
codice:
void handleCausaleOperatore()
{
AosClearDisplay( 0 );
AosSetDisplayLocation(0, 0);
printf(" ARCHIMEDE");
AosSetDisplayLocation(0, 2);
printf(" UTENTE");
AosSetDisplayLocation(0, 3);
printf("CAUSALE?");
enableKeyboardNoScan( 4 );
AosSuspendTask( tk_user1 );
laststep = nextstep;
nextstep = WAIT_CAUSALE_OPERATORE;
}
handleWaitCausaleOperatore( VOID )
{
AosSetDisplayLocation(0, 4);
printf( " " );
AosSetDisplayLocation(0, 4);
printf( "%s", k.buffer );
#ifdef M16APL
AosBeep( C7_NOTE, 50 );
#endif
if( k.result == KBD_STOPPED )
{
if ( strlen( k.buffer) != 0 )
{
#ifdef M16APL
AosBeep( C7_NOTE, 50 );
#endif
sprintf( causale_string, "%04s", k.buffer );
AosSetDisplayLocation(9, 2);
printf( "%s", causale_string );
nextstep = SALVA_UTENTE;
}
else
nextstep = CAUSALE_OPERATORE;
AosDriveRedLed( OFF );
AosStopKeyboard();
}
else
AosSuspendTask( tk_user1 );
}
grazie a tutti in anticipo....
************************************************** *********************************
un mio collega mi ha dato un suggerimento..........su come devo procedere
ma comunque ho bisogno di aiuto perchè pultroppo ho appena iniziato e mi hanno messo a fare sta cosa che non ne vengo fuori da nessun lato.
Il programma è stato fatto con una logica a stati:
quindi devo modificare così il programma
codice:
BYTE handleSalvaUtente()
/*PIPPO */
if
else {
static XBYTE format[ 0xff ];
if ( fCausale == FALSE )
strcpy( causale_string, "0090" );
strcpy( format, "%10s0%10s%6s%10s%6s%04s%10s%10s%6s" );
strcat( format, "%02d%02d20%02d%02d%02d%02d");
strcat( format, "%02d%02d20%02d%02d%02d%02d");
sprintf( buffer,format,
idTerminale, //0
apri_operatore_string, //11
KM_OP1_string, //21
" ", //27
KM_UT1_string, //37
causale_string, //43
apri_utente_string, //47
chiudi_utente_string, //57
KM_UT2_string, //67
data_ora_i.mday,
data_ora_i.mon,
data_ora_i.year % 100,
data_ora_i.hour,
data_ora_i.min,
data_ora_i.sec,
FineUtenteClock.mday,
FineUtenteClock.mon,
FineUtenteClock.year % 100,
FineUtenteClock.hour,
FineUtenteClock.min,
FineUtenteClock.sec);
if ( PutDatabaseRecord() != 0 )
{
nextstep = DBFULL;
return 1;
}
if ( fKM == TRUE )
nextstep = KM;
else
{
nextstep = TAG_UTENTE;
}
return 0;
}
qui arrivo dall'altro pezzo di codice che ho postato prima.
Devo dire che torni indietro allo stato precedente fino a quando non digito un tasto da tastiera.......
Aiuto, non so nenache come iniziare...o scritto if/else e molto probabilmente non è giusto nenache quello.... [CODE] v [ /CODE]