Thread: Web Programming with C++??

  1. #1
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542

    Web Programming with C++??

    I heard that you can program/script websites using C++, does it mean like with PHP? And where can I find more information about it and how do I try it? I have apache server.. PHP.. MySQL and got a lot of practice in PHP+MySQL..
    what does signature stand for?

  2. #2
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    There is a tutorial called Getting Started with CGI Programming in C by Jukka K. Korpela (at http://www.cs.tut.fi/~jkorpela/forms/cgic.html), and I'm sure you can use it to figure out how to write CGI programs in C++.

    You're better off using Perl. There's no real benefit to using C++; it's slightly worse than PHP for this kind of thing, which is bad itself.

  3. #3
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    oh.. thanks.. another question.. what can PHP that Perl (or CGI) cant?..
    what does signature stand for?

  4. #4
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    PHP has some "features" like changing the contents of your strings without telling you about it (on some installations but not on others). I recommend avoiding it at all costs. (The language does not have arrays. How's that for interesting?)

    "CGI" is not a programming language; it stands for Common Gateway Interface.

  5. #5
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    » The language does not have arrays. How's that for interesting?

    oh really?

    there's nothing wrong with PHP. it's closer to C++ than Perl, and easier to deal with (because you don't need CGI). I've never heard (or experienced) any strings changing without me changing them...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  6. #6
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Quote Originally Posted by major_small
    » The language does not have arrays. How's that for interesting?

    oh really?
    These are hashes, not arrays. Try doing a foreach on an 'array'. It will be in the order you inserted the elements, not in any kind of sensible order.

    there's nothing wrong with PHP. it's closer to C++ than Perl, and easier to deal with (because you don't need CGI). I've never heard (or experienced) any strings changing without me changing them...
    There's a lot wrong with PHP. Some installations insert slashes into strings input from a form; others don't.

    Being closer to C++ than Perl is bad -- it's closer in terms of lack of features, farther in terms of efficiency.

    Not that Perl is the ultimate programming language...
    Last edited by Rashakil Fol; 07-18-2005 at 02:05 PM.

  7. #7
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    Quote Originally Posted by Rashakil Fol
    Some installations insert slashes into strings input from a form; others don't.
    that is the code from the site scripter, not the language itself.
    with php, you have to escape special characters or they will be interpreted and executed. inserting \ makes the characters only be ther ascii value. the problem lies with not removing them when displaying the contents.

  8. #8
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Quote Originally Posted by Jaqui
    that is the code from the site scripter, not the language itself.
    with php, you have to escape special characters or they will be interpreted and executed. inserting \ makes the characters only be ther ascii value. the problem lies with not removing them when displaying the contents.
    I don't think you know what I am refering to, or you're simply not communicating this knowledge. These are PHP's "magic quotes."

    From http://docs.php.net/en/security.magicquotes.html:

    Assuming it to be on, or off, affects portability. Use get_magic_quotes_gpc() to check for this, and code accordingly.

  9. #9
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    yup, and when the site isn't scripted accordingly you get the \ in the output that Rashakil was mentioning.

    that's what I meant by its the coders fault, not a language fault.

    personally, I preffer to have them off, making more work for coding, simply as then it's a consistent platform.
    ( and the last time I checked to docs, also recommended for magic quotes )
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  10. #10
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    Eh, it does have arrays, they are represented as hashes and arrays at the same time. If you use a subscript operator to access an element, you will get it back in the order you saved it in, just like an array.

    True PHP does have problems, but so does pretty much every other language, or quirks that you have to deal with. You can always shut off magic quotes and the like by calling ini_set (if I remember that function call correctly) and change the behavior as you see fit.

    All in all this thread did get derailed...

    So to the original question you can do web programming with C++, either through CGI (which can support a lot of different languages) or asp or the like.

  11. #11
    Registered User
    Join Date
    Jul 2005
    Posts
    10
    ASP really sucks though. If you're going to use a scripting language, use PHP or ASP.NET.

    ---------------------------------------Edited---------------------------------------
    Also, I've heard scripting languages are faster than CGI. Just something I thought I'd throw in...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MS Web Services Question
    By mercury529 in forum Windows Programming
    Replies: 0
    Last Post: 11-14-2006, 06:36 PM
  2. Consuming same Web Service multiple times
    By cfriend in forum C# Programming
    Replies: 2
    Last Post: 01-10-2006, 09:59 AM
  3. SWEBS Web Server
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 09-22-2003, 02:46 AM
  4. Further developing C for the web
    By bjdea1 in forum C Programming
    Replies: 24
    Last Post: 12-25-2002, 01:49 PM