Sbrocca88
03-11-2010, 08:56
Ciao a tutti sono alle prime armi con la programmazione.
Devo fare un programma in c++ che ad un certo punto mi deve lanciare una applicazione chiamata audacity.
Io uso windows però il programma viene lanciato da una shell chiamata cygwin che mi emula linux.
è da un sacco che provo a sbatterci la testa senza riuscirci.
Qualcuno può aiutarmi?!
Ecco il mio programma
#include <iostream>
#include <stdlib.h>
#include <fstream>
using namespace std;
void nuovoprofilo();
int main()
{
char ch, nome_cognome[50];
cout << "Nuovo (n), Salvare (s) Lanciare (r) Uscire (q)" << endl;
cin >> ch;
while (ch!='q')
{
switch (ch)
{
case 'n':
cout << "Inserire nome e cognome" << endl;
cin.getline(nome_cognome,50); //perchè non funziona?!
cin.getline(nome_cognome,50);
nuovoprofilo();
break;
case 's':
//salvaprofilo();
break;
case 'r':
//lanciaprofilo();
break;
default : cout << "Nuovo (n), Salvare (s) Lanciare (r) Uscire (q)" << endl;
}
cin >> ch;
}
return 0;
}
void nuovoprofilo()
{
ofstream fout ("sample.grammar");
fout << "S : NS_B COMANDO OGGETTO NS_E" << endl << "S : NS_B RICHIESTA NS_E" << endl;
fout.close();
ofstream fout2 ("sample.voca");
fout2 << "% NS_B" << endl << "<s> sil" << endl << endl << "% NS_E" << endl << "</s> sil" << endl << endl << "% COMANDO" << endl << "ACCENDI a cc e n d i" << endl << "SPEGNI s p e ggn i" << endl << endl << "% OGGETTO" << endl << "LUCE l u c e" << endl << "TEIERA t e j e r a" << endl << endl << "% RICHIESTA" << endl << "AIUTO a j u t o" << endl;
fout2.close();
cout << "Registra la tua voce";
//system("\"C:\\cygwin\\home\\Ciucci\\voxforge\\auto_ita\\prompts\"");
system("\"C:\\Program Files\\Audacity\\audacity.exe\"");
}
La chiamata della mia funzione audacity l'ho messa nella funzione void nuovoprofilo() utilizzando la funzione system.
Ma non funziona.
Mi dice:
sh : C:\\Program Files\\Audacity\\audacity.exe command not found
Devo fare un programma in c++ che ad un certo punto mi deve lanciare una applicazione chiamata audacity.
Io uso windows però il programma viene lanciato da una shell chiamata cygwin che mi emula linux.
è da un sacco che provo a sbatterci la testa senza riuscirci.
Qualcuno può aiutarmi?!
Ecco il mio programma
#include <iostream>
#include <stdlib.h>
#include <fstream>
using namespace std;
void nuovoprofilo();
int main()
{
char ch, nome_cognome[50];
cout << "Nuovo (n), Salvare (s) Lanciare (r) Uscire (q)" << endl;
cin >> ch;
while (ch!='q')
{
switch (ch)
{
case 'n':
cout << "Inserire nome e cognome" << endl;
cin.getline(nome_cognome,50); //perchè non funziona?!
cin.getline(nome_cognome,50);
nuovoprofilo();
break;
case 's':
//salvaprofilo();
break;
case 'r':
//lanciaprofilo();
break;
default : cout << "Nuovo (n), Salvare (s) Lanciare (r) Uscire (q)" << endl;
}
cin >> ch;
}
return 0;
}
void nuovoprofilo()
{
ofstream fout ("sample.grammar");
fout << "S : NS_B COMANDO OGGETTO NS_E" << endl << "S : NS_B RICHIESTA NS_E" << endl;
fout.close();
ofstream fout2 ("sample.voca");
fout2 << "% NS_B" << endl << "<s> sil" << endl << endl << "% NS_E" << endl << "</s> sil" << endl << endl << "% COMANDO" << endl << "ACCENDI a cc e n d i" << endl << "SPEGNI s p e ggn i" << endl << endl << "% OGGETTO" << endl << "LUCE l u c e" << endl << "TEIERA t e j e r a" << endl << endl << "% RICHIESTA" << endl << "AIUTO a j u t o" << endl;
fout2.close();
cout << "Registra la tua voce";
//system("\"C:\\cygwin\\home\\Ciucci\\voxforge\\auto_ita\\prompts\"");
system("\"C:\\Program Files\\Audacity\\audacity.exe\"");
}
La chiamata della mia funzione audacity l'ho messa nella funzione void nuovoprofilo() utilizzando la funzione system.
Ma non funziona.
Mi dice:
sh : C:\\Program Files\\Audacity\\audacity.exe command not found