Thread: Mozilla - C - and perl

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    6

    Mozilla - C - and perl

    Hello everyone.

    I really need some help. I was wondering if it was possible to open and execute a mozilla web browser through c code possibly using a fork/ can this be done/
    If it can, some source code or idas would be helpful!

    Danielle

  2. #2
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    If your going to use C and not C++, than you posted in the wrong section.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    6
    whoops...
    I am actually using C++, small typo, I was typing quickly.
    But do you have any ideas?

    Danielle

  4. #4
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    While i look for an answer, whats perl have to do with this?

  5. #5
    Registered User
    Join Date
    Feb 2003
    Posts
    6
    I tried what you suggested but no window opened up....

    danielle

  6. #6
    Registered User
    Join Date
    Feb 2003
    Posts
    6
    Hey Rob,

    I could possibl try doing it in perl, I put that in there in case anyone new how to do it in perl

    Danielle

  7. #7
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    exactly how much programming have u done in c++?

  8. #8
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    Posts
    362
    >>I could possibl try doing it in perl, I put that in there in case anyone new how to do it in perl
    It's a piece of cake :-)
    Code:
    #!usr/bin/perl -w
    
    use Errno qw(EAGAIN);
    
    FORK: {
      if ($pid = fork) {
        # Do something
        print "Parent closing\n";
        exit(0);
      }
      elsif (defined $pid) {
        # Open a browser
        exec '/usr/bin/mozilla';
      }
      elsif ($! == EAGAIN) {
        sleep 5;
        redo FORK;
      }
      else {
        die "Can't fork: $!\n";
      }
    }
    *Cela*

Popular pages Recent additions subscribe to a feed