home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
open.zip
/
open.c
next >
Wrap
C/C++ Source or Header
|
1995-03-30
|
806b
|
35 lines
#define INCL_DOS
#include <os2.h>
#include <stdio.h>
void DisplayHelp(void);
main(int argc, char *argv[]) {
char filename[2048];
HOBJECT hobj;
if (argc < 2) {
DisplayHelp();
return 0;
}
// Get the fully qualified path name of the file specified in argument 1
DosQueryPathInfo(argv[1], FIL_QUERYFULLNAME, filename, 2048);
// Open the file
hobj = WinQueryObject(filename);
WinSetObjectData(hobj, "OPEN=DEFAULT");
return 1;
}
void DisplayHelp(void) {
printf("Usage:\n");
printf(" open filename\n");
printf("\nwhere\n\n");
printf(" filename is the name of the file to open.\n");
printf("\nThe specified file will be opened by the application\n");
printf("that would run if you double-clicked on the file's icon\n");
printf("from the WPS.\n");
}