Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 04-14-2009, 04:08 PM   #1 (permalink)
Registered User
 
Join Date: Apr 2009
Posts: 6
OS: linux


Question hot to put a c++ program in the web ?

Dear all,

I have a huge c++ program (gcc compiled) that runs on a linux console. It's an interactive program in the sense that it requires the user to enter some information through the console in order to process and give some complicated output (cout, cin). For a naive illustration, imagine a program asking you for your age on the console, you enter it and the program gives you your year of birth. The same, but a bit more complicated is my program.

My problem is just that I need it to be executed in a browser by people on the other side of the world. I do have a server where it can run, but I don't know how to make the necessary interface. Could someone of you please help me out?

I thank you in advance
rasslove is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 04-16-2009, 12:59 PM   #2 (permalink)
Registered User
 
Join Date: Apr 2009
Posts: 2
OS: windows xp


Re: hot to put a c++ program in the web ?

Try posting in the html/web forums - they might be able to help out.
Prague Hotel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-16-2009, 02:58 PM   #3 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,888
OS: Vista, various linux distros


Re: hot to put a c++ program in the web ?

It cannot be executed in a browser sorry. No exe could. It could be executed by the server, but the user would not be aware of this (so would not be able to input data). And you could have the user download the exe and execute it on their machine, but what you want to do can't be done.

It's also illogical as you've compiled for linux and the majority of the world use windows, if this were possible you'd be crashing pcs everywhere ;P.

Why do you need it to run like this? it's possible to take the input, then push that into your program using a server side language(e.g. PHP).

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-17-2009, 03:24 AM   #4 (permalink)
Registered User
 
Join Date: Apr 2009
Posts: 6
OS: linux


Thanks

Hi guys,

Thank you for your reply. I think I'm going to do it as you say: I'll pick up the input in a normal textbox and then push it into my executable. I thought though, that there might be a way (maybe through a java console or something similar) to execute my program from the web. Of course, it'd run on the server (that, as most of the internet servers, would be linux/unix), and a sort of console would be just an interface. I thought that could be possible. However, I'm not an expert. That's why I'm asking here.

Anyway, I think the php/perl solution is the simplest one.

Thanks again.
rasslove is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-17-2009, 06:25 AM   #5 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,888
OS: Vista, various linux distros


Re: hot to put a c++ program in the web ?

Hey again, there are ways to do it without re-loading the page but all would use the simple method: Get Input, Send HTTP Request, Inject Input into program. Basically using AJAX/Java you could fool the user into thinking they're using the program but it would be just as complicated as re-writing the program for a different language.

Good Luck coding this, if you need any help please post back =]

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-20-2009, 07:39 AM   #6 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,888
OS: Vista, various linux distros


Re: hot to put a c++ program in the web ?

MegaSpam. Anyone who read the above post, sites like that are registered to by the examining boards who test you and moderate your coursework, the have an index of each of the pieces written and compare your coursework with them. If your coursework has more than an 85% match you get disqualified immediately. if it's more than 60% then you're put up for report, in which they'll question your knowledge on the subject in an interview and can even put you up against a polygraph test. It's easier to read a book and write an assignment than to get through that. Do not click the link.

The site may not even be legitimate, note "david" in the name and yet the end of the message is "cheers! emily"? haha. Spammer's annoy me, someone please remove.
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-21-2009, 08:55 AM   #7 (permalink)
Registered User
 
Join Date: Apr 2009
Posts: 6
OS: linux


Exclamation Re: how to put a c++ program in the web ?

Hi Jamey,

Thanks for you help (your last post was maybe an error, wasn't it?)

Yet I have still some problems. I want to run my c++ program in background by using the command
$cmdstr = "./myc++program > /dev/null 2> /dev/null & echo $!";
$PID = shell_exec($cmdstr);

I need the PID because I want eventually to terminate the program:
exec("ps " . $PID, $state);
if(count($state) >= 2)
**
exec("kill -9 " . $PID);
echo "Program terminated!";
}

The problem is that the condition in the IF (i.e. verifying whether my program is still running) is never fulfilled. This tells me that either a) my program is never started or (even worse) b) my program does run in background, but I can't terminate it.

Can you help me?

Cheers,
Saul
rasslove is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-21-2009, 02:05 PM   #8 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,888
OS: Vista, various linux distros


Re: hot to put a c++ program in the web ?

What does $state return?
And does the program not just finish executing and close?

oh and my last post was because a user/bot posted some spam about getting GCSE/A level assignments done online. But that's gone now.
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-22-2009, 03:00 AM   #9 (permalink)
Registered User
 
Join Date: Apr 2009
Posts: 6
OS: linux


Re: how to put a c++ program in the web ?

Hi Jamey,

I'm here again. The variable $state returns an array containing the result of "ps"; in the current case, it returns only
PID TTY TIME CMD
that is, only one line, that's the reason why it never enters the IF clause.

Something I didn't mention before is that the php script that start my c++ program and the script that kills it are different files. In the meanwhile, I noticed that this is perhaps the problem. One php script starts the program in background, but once the php file is executed, it automatically terminates my c++ program. Thus, a reasonable question could be whether there is a way to mimic the console command
...> ./myc++program &
so that it keeps running in the background even after I finish the php program. Do you think that "nohup" might do it?

Thanks!
rasslove is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-22-2009, 07:35 AM   #10 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,888
OS: Vista, various linux distros


Re: hot to put a c++ program in the web ?

Take a look at this.

It might help. I think that is the problem anyway, and that the post that link takes you to might get around it =]

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-24-2009, 02:45 AM   #11 (permalink)
Registered User
 
Join Date: Apr 2009
Posts: 6
OS: linux


Re: hot to put a c++ program in the web ?

Hey Jamey, thanks for your help. My program seems to work properly now. There are still other security issues that I have to fix, but I think that by using SESSIONS all problems will be gone. Thanks again!
rasslove is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-24-2009, 08:59 AM   #12 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,888
OS: Vista, various linux distros


Re: hot to put a c++ program in the web ?

Glad to be of help. Glad you got it sorted =]
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 12:40 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85