16/06/17 13:22
FeFeZ
Ciao a tutti, dopo aver compilato il seguente programma mi escono questi due errori :
1- cannot open output file bin\Debug16-06-16.exe Permission denied|
2- error: ld returned 1 exit status|
Riuscireste a spiegarmi cosa significano quei due errori e come risolverli? Grazie in anticipo!
PS: Il file l'ho creato
Il programma è il seguente:
1- cannot open output file bin\Debug16-06-16.exe Permission denied|
2- error: ld returned 1 exit status|
Riuscireste a spiegarmi cosa significano quei due errori e come risolverli? Grazie in anticipo!
PS: Il file l'ho creato
Il programma è il seguente:
#include <stdio.h> #include <stdlib.h> #define NOME "segovia.txt" #define N 10 #include <time.h> int main(int argc, char *argv[]) { int i,j,Iron,Thor,tempo_rim,bomba_dis=0,tempo,k,y,bombe_attive; char mappa[N][N]; if(argc!=2) { printf("errore linea di comando"); return -1; } FILE *fp; fp=fopen(NOME,"r"); if(fp==NULL) { printf("errore apertura file"); return -2; } //salvo la mappa for(i=0;i<N;i++) { for(j=0;j<N;j++) { fscanf(fp,"%c",&mappa[i][j]); } } fclose(fp); //estrazione numer;o casuale sscanf(argv[1],"%d",&tempo_rim); i=0; j=0; k=0; y=0; for(tempo=0;tempo<tempo_rim;tempo=tempo+10) { srand(time(NULL)); Iron=rand()%4; Thor=rand()%4; if(Iron==0) { i++; if(mappa[i][j]=='B'){ bomba_dis++; } else { if(i>N-1||mappa[i][j]=='*') { i--; } } printf("Time: %d Pos: I(%d,%d) ",tempo,i,j); } if(Iron==1) { i--; if(mappa[i][j]=='B'){ bomba_dis++; } else { if(i<0||mappa[i][j]=='*') { i++; } } printf("Time: %d Pos: I(%d,%d) ",tempo,i,j); } if(Iron==2) { j++; if(mappa[i][j]=='B'){ bomba_dis++; } else { if(j>N-1||mappa[i][j]=='*') { j--; } } printf("Time: %d Pos: I(%d,%d) ",tempo,i,j); } if(Iron==3) { j--; if(mappa[i][j]=='B'){ bomba_dis++; } else { if(j<0||mappa[i][j]=='*') { j++; } } printf("Time: %d Pos: I(%d,%d) ",tempo,i,j); } if(Thor==0) { k++; if(mappa[k][y]=='B'){ bomba_dis++; } else { if(k>N-1||mappa[k][y]=='*') { k--; } } printf("Time: %d Pos: T(%d,%d) ",tempo,k,y); } if(Thor==1) { k--; if(mappa[k][y]=='B'){ bomba_dis++; } else { if(k<0||mappa[k][y]=='*') { k++; } } printf("Time: %d Pos: T(%d,%d) ",tempo,k,y); } if(Thor==2) { y++; if(mappa[k][y]=='B'){ bomba_dis++; } else { if(y>N-1||mappa[k][y]=='*') { y--; } } printf("Time: %d Pos: T(%d,%d) ",tempo,k,y); } if(Thor==3) { y--; if(mappa[k][y]=='B'){ bomba_dis++; } else { if(y<0||mappa[k][y]=='*') { y++; } } printf("Time: %d Pos: T(%d,%d) ",tempo,k,y); } } bombe_attive=0; for(i=0;i<N;i++) { for(j=0;j<N;j++) { if(mappa[i][j]=='B') { bombe_attive++; } } } if(bombe_attive==bomba_dis) { printf("Missione riuscita"); } else { printf("Missione fallita"); } return 0; }
Ultima modifica effettuata da FeFeZ 16/06/17 13:23
aaa