Code:
#include <stdio.h>
#include <string.h>
void strip_newline( char *str, int size )
{
int i;
for ( i = 0; i < size; ++i )
{
if ( str[i] == '\n' )
{
str[i] = '\0';
return;
}
}
}
int main()
{
char command[100];
FILE *fp;
printf( "Select Program\n" );
fgets( command, 100, stdin );
strip_newline( command, 100 );
if ( strcmp ( command, "Programmer's Notepad" ) == 0)
{
fp=fopen("Apps/PN/pn.exe", "r");
}
fgets( command, 100, stdin );
strip_newline( command, 100 );
getchar();
return 0;
}
Can somebody help me wit this? I want it so when you type "Programmer's Notepad", it opens Programmer's Notepad from a folder called apps.
[Project Folder]
Project.exe
[Apps]
[PN]
pn.exe
That's My file setup.
Bookmarks