Is there a system call to open HTML file programatically?
Is there a way (like some system call) to simply open up an HTML file
programatically from within an application which the user could read,
and then close off and return to the application from where the HTML
file was invoked?
I've been poking around Apple's documentation but I'm not finding
anything.
programatically from within an application which the user could read,
and then close off and return to the application from where the HTML
file was invoked?
I've been poking around Apple's documentation but I'm not finding
anything.
Um, fopen/scanf?
Er, what? Ask questions in English

This is what I use in my Cocoa code for displaying a HTML file from my program in the default web browser.
or this code will open a HTML in the default program for viewing HTML files
However you have to be careful with this as on my computer GoLive is the default application for viewing HTML files opened this way.
Code:
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.url.co.uk/whatever.html"]];
or this code will open a HTML in the default program for viewing HTML files
Code:
[[NSWorkspace sharedWorkspace] openFile:@"filepath/filename.html"];
However you have to be careful with this as on my computer GoLive is the default application for viewing HTML files opened this way.
I think you mean that the HTML file is opened in Safari or something, right? You could try issuing a system call with "open path/to/my/file"... I dug around the Cocoa docs for a while, but strangely I couldn't find anything.
in Cocoa, NSWorkspace handles opening files and URLs in other applications, in Carbon LaunchServices does the same. LaunchServices has a couple more features than NSWorkspace, so it may occasionally be necessary to use LS from Cocoa (not that that's hard, given the toll-free bridging of CFString<->NSString and CFURL<->NSURL).
I've got a C++ application. Don't want to use Carbon. Tried just sticking
the [[NSWorkspace sharedWorkspace] openFile:@"filepath/filename.html"];
into it with this header that I got by looking at a Cocoa template project
in Xcode.
#import <Cocoa/Cocoa.h>
I get 9,742 errors which I belive is a record for me
I don't know one iota about objective C. Come to think of it, I don't even know
what an iota is
Is it possible to incorporate this snippet of objective c into a C++ application?
If it is trivial, could someone just post the code. I'm thinking it might be about
a long as a "hello world" program, but then I could be wrong here as well.
the [[NSWorkspace sharedWorkspace] openFile:@"filepath/filename.html"];
into it with this header that I got by looking at a Cocoa template project
in Xcode.
#import <Cocoa/Cocoa.h>
I get 9,742 errors which I belive is a record for me

I don't know one iota about objective C. Come to think of it, I don't even know
what an iota is

Is it possible to incorporate this snippet of objective c into a C++ application?
If it is trivial, could someone just post the code. I'm thinking it might be about
a long as a "hello world" program, but then I could be wrong here as well.
If it's just a file localized on your HDD, I still recommend using fopen and fread.
If you don't want to use Carbon or Cocoa, use Fenris's idea:
Code:
system("open /path/to/myfile.html");
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
akb825 Wrote:If it's just a file localized on your HDD, I still recommend using fopen and fread.
Using this method you would need to have something in your application for rendering the HTML.
I think what he is asking for is a method to allow an external application designed for the purpose to do it.
I thought he was asking how to just show the code. I'm wondering if there's a class that just takes text and renders the HTML, though. (since I know there are HTML classes in Carbon and Cocoa)
Bingo. "...Renders the HTML" That's what I should of said.
WebKit might be the way to go...
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
how to call fathers setNeedsDisplay from child. | iluzone | 5 | 8,818 |
Dec 7, 2006 04:11 AM Last Post: iluzone |
|
Call For Help: The Game Track Open Source Project | jolivierld | 2 | 3,830 |
Aug 30, 2005 03:48 AM Last Post: jolivierld |