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

    [C++]Problema dichiarazione array

    Un saluto a tutti

    Ecco una parte del mio codice:

    codice:
    void WriteToPipe(pipe_t &Child_IN_Wr, char nome_cognome[NAMESIZE], int num)           //Gli passo nome come parametro 
    
    // Write to the pipe for the child's STDIN. 
    { 
      #ifdef WIN32
       DWORD dwRead, dwWritten;
       BOOL bSuccess = FALSE;
       int length;
       if (num=1)
            {
            char tmp1[] = "cd VocaleConsole\ncd Exe\ncd Profiles\ncd ";
            char tmp2[] = "\ncd Model\ndos2unix *.*\n./HTK_Compile_Model.sh \n";
            }
       else
           {
           char tmp1[]="cd VocaleConsole\ncd Exe\ncd Profiles\ncd ";
           char tmp2[]="\ncd test\nHCopy -A -D -T 1 -C wav_config -S codetrain.scp\njulian -input rawfile -filelist wavlst -smpFreq 48000  -C julian.jconf  > juliusOutput\n./ProcessJuliusOutput.pl juliusOutput juliusProcessed\nHResults -I testref.mlf tiedlist juliusProcessed";
           }
    
       length = sizeof(tmp1)+sizeof(tmp2)+sizeof(nome_cognome);
       char *chBuf=(char *) malloc(length);
       
       strcpy (chBuf,tmp1);
       strcat (chBuf,nome_cognome);
       strcat (chBuf, tmp2);
       
            
       bSuccess = WriteFile(Child_IN_Wr, chBuf,length, &dwWritten, NULL);
    // Close the pipe handle so the child process stops reading. 
     
       if ( ! CloseHandle(Child_IN_Wr) ){
           cout<<"error: Close handle\n"; 
          return; 
          } 
       #endif
    }
    Quando lo compilo mi dice che l array tmp1 e tmp2 non sono dichiarati.
    Come mai?! Dove sbaglio?!
    Un saluto

  2. #2
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381

    Re: [C++]Problema dichiarazione array

    Originariamente inviato da Giovanni Pr88
    Dove sbaglio?!
    Hai presente il concetto di visibilità delle variabili?
    I due array (che poi array non sono) sono visibili quando li vai a usare? O sono interni ai blocchi in cui li dichiari?
    This code and information is provided "as is" without warranty of any kind, either expressed
    or implied, including but not limited to the implied warranties of merchantability and/or
    fitness for a particular purpose.

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.