Visualizzazione dei risultati da 1 a 10 su 10
  1. #1

    [C] stringhe chiarimenti ...

    se faccio un:

    scanf("%s", t);

    dove:

    char* t[100];

    ricevo da tastiera la stringa t ... d'accordo

    Esiste un comando che mi permetta di ricevere stringhe diverse da un'unica digitazione,

    mi spiego:

    termine da cercare:

    HONDA VTR-1000 SP2

    (DIGITATO IN UNA SOLA VOLTA E CONFERMATO CON INVIO)

    che comando devo usare per ricevere:

    s=[honda]
    m=[vtr-1000]
    t=[sp2]

    GRAZIE PER ILLUMINARMI SEMPRE

    CIAO A TUTTI

  2. #2
    beh dovresti far uso dei token...
    non dirmi come.. cerca e studia!
    if u think u'r too small to make a difference, try sleeping with a mosquito!!

    Giochi a calcetto? Vuoi prenotare online il tuo campo preferito?

  3. #3
    ok i token

    ma quale funzione?

    non ho capito molto bene ...

    Scusate

    GRAZIE

  4. #4
    Utente bannato
    Registrato dal
    Nov 2003
    Messaggi
    558

    Re: [C] stringhe chiarimenti ...

    Originariamente inviato da visualnic


    che comando devo usare per ricevere:

    s=[honda]
    m=[vtr-1000]
    t=[sp2]

    GRAZIE PER ILLUMINARMI SEMPRE

    CIAO A TUTTI
    Guarda che basta un :

    codice:
    scanf ("%s %s %s",s,m,t) ;

  5. #5
    la funzione si chiama strtok(...)
    La luce è più veloce del suono,ecco xchè alcune persone sembrano brillanti fino a quando non parlano


  6. #6
    Grazie a tutti adesso provo

    CIAO

  7. #7
    Ho provato la seguente

    scanf ("%s %s %s",s,m,t) ;

    praticamente mi riceve tre stringhe s m e t

    e se io non conosco a priori il numero delle stringhe che posso inserire?


    Io ho trovato:

    char *strtok(s , ct)


    che fa?

    GRAZIE CIAO

  8. #8
    char* strtok(char* s, const char* t);

    A sequence of calls to strtok returns tokens from s delimted by a character in ct. Non-NULL s indicates the first call in a sequence. ct may differ on each call. Returns NULL when no such token found.


    NON HO CAPITO BENE LA FUNZIONE DEI TOKEN ....

  9. #9

  10. #10
    Grazie

    perfetto

    CIAO A TUTTI

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.