ok so I am just writing to play around with my new mac and I got a lot of errors compiling it. I figured all of them out but two. Heres the code:
and heres the errors I got compiling with gcc:Code:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
main()
{
char choice[8];
printf(" This program can open applications or delete files\n");
printf(" Please select what you like to do\n");
printf(" enter 'Delete' to delete files, or 'open' to open\n");
scanf(" %s", choice);
if((toupper(choice[1]) == 'O')||(toupper(choice[1]) == 'D'))
{
if(toupper(choice) == 'Open')
{
char empty1[25];
char empty2[55];
char applic[15];
printf("Type in the name of the app\n");
scanf(" %s", applic);
sprintf(empty1, "open -a %s", applic);
sprintf(empty2, "%s.app", empty1);
system(empty2);
}
if(toupper(choice) == 'Delete')
{
char location[35], cdcomm[39], name[23], systemname[28];
printf("Type the location of the file\n");
printf("Ex: Macintosh HD is in the folder 'Desktop'\n");
printf("Keep in mind capitalization DOES COUNT\n");
printf("so now tell me the address of the file\n");
scanf(" %s", location);
sprintf(cdcomm, "cd %s", location);
system(cdcomm);
printf("Now tell me the name and type of file it is\n");
printf("Ex: examplefile.txt\n");
scanf(" %s", name);
sprintf(systemname, "rm %s", name);
}
}
else
{
Printf("An error occured please restart\n");
}
return 0;
}
new-host:Desktop Alex$ gcc final.c
final.c:36:25: warning: character constant too long for its type
Undefined symbols:
"_Printf", referenced from:
_main in ccjQRlV5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
new-host:Desktop Alex$
with the "36" and the "25" being the lines that the errors are on
if you know why or what the deal is please tell me. Oh and btw the part where it opens an app worked exactly as it was when I had a program that just opened an app.