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

    Funzione substr e altro. Aiuto!

    sono a digiuno di C++. Ho questo script che dovrebbe prendere in ingresso un parametro stringa, scandire carattere x carattere, trasformarlo e stamparlo con printf ma il compilatore GCC (DJGPP per Windows) mi continua a dare una serie di errori. cosa sbaglio?


    licenza.cpp:3: error: second argument of 'int main(int, void**)' should be 'char
    **'
    licenza.cpp: In function 'int main(int, void**)':
    licenza.cpp:11: error: invalid conversion from 'void*' to 'const char*'
    licenza.cpp:11: error: initializing argument 2 of 'char* strncpy(char*, const
    char*, size_t)'
    licenza.cpp:13: error: request for member 'lenght' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:15: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:16: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:18: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:19: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:21: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:22: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:24: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:25: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:27: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:28: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:30: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:31: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:33: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:34: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:36: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:37: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:39: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:40: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:42: error: request for member 'substr' in 'regCode', which is of non
    -class type 'char [255]'
    licenza.cpp:43: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:47: error: invalid operands of types 'const char [4]' and 'char [255
    ]' to binary 'operator+'
    licenza.cpp:50: error: request for member 'lenght' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:52: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:53: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:55: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:56: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:58: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:59: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:61: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:62: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:64: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:65: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:67: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:68: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:70: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:71: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:73: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:74: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:76: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:77: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:79: error: request for member 'substr' in 'keygen', which is of non-
    class type 'char [255]'
    licenza.cpp:80: error: invalid operands of types 'char [255]' and 'const char [2
    ]' to binary 'operator+'
    licenza.cpp:89: error: 'printf' was not declared in this scope

  2. #2
    Utente di HTML.it L'avatar di Stoicenko
    Registrato dal
    Feb 2004
    Messaggi
    2,254
    bè apparte che la serie di errori e meglio metterla tra tag code così sono più leggibili..

    Il primo errore già ti dice che il main vuolr un char** e non un void**,

    codice:
    int main (int arg, char** args)
    Il secondo indica che c'è un errore nell'inizializzazione del secondo parametro passato alla strncpy.. intanto risolvi questi

    in più se non ci fai vedere il codice non possiamo aiutarti poi molto..

  3. #3
    Moderatore di Programmazione L'avatar di LeleFT
    Registrato dal
    Jun 2003
    Messaggi
    17,303

    Moderazione

    Aggiungo che il linguaggio va obbligatoriamente specificato nel titolo (come da Regolamento)


    Ciao.
    "Perchè spendere anche solo 5 dollari per un S.O., quando posso averne uno gratis e spendere quei 5 dollari per 5 bottiglie di birra?" [Jon "maddog" Hall]
    Fatti non foste a viver come bruti, ma per seguir virtute e canoscenza

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.