Ticket #13985: testexec.C

File testexec.C, 667 bytes (added by donn, 6 years ago)
Line 
1//
2// Example illustrating problem with be_roster->Launch()
3//
4// Compile as C++, either gcc-2.95 or setarch x86, and invoke with
5// the name of an existing text file.
6//
7#include <stdio.h>
8#include <stdlib.h>
9#include <string.h>
10#include <app/Application.h>
11#include <app/Roster.h>
12#include <kernel/OS.h>
13
14extern "C" int
15signatureLaunch(const char *signature, const char *file)
16{
17 BMessage *msg = new BMessage(B_REFS_RECEIVED);
18 BEntry *entry = new BEntry(file);
19 entry_ref ref;
20 entry->GetRef(&ref);
21 msg->AddRef("refs", &ref);
22 return be_roster->Launch(signature, msg);
23}
24
25int
26main(int argc, char **argv)
27{
28 signatureLaunch("text/plain", argv[1]);
29 return 0;
30}