Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

walters

  • 3 years ago

c++ question can u pls run this code and help me to remove the warnings #include<iostream> #include<string> #include<cstdlib> using namespace std; int main() { char postString[1024]=""; string dataString =""; string nameString =""; string passwordString=""; int contentLength=0; if( getenv("CONTENT_LENGTH") ) contentLength= atoi(getenv("CONTENT_LENGTH")); cin.read(postString,contentLength); dataString = postString; int namelocation = dataString.find("namebox=")+8; int endNamelocation = dataString.find("&"); int password = dataString.find("passwordbox=")+12; int endPassword = dataString.find("&button"); nameString = dataString.substr(namelocation,endNamelocation-namelocation); passwordString=dataString.substr(password,endPassword-password); cout<<"content-Type:texthtml\n\n"; cout<<"<?xml version = \"1.0\"?>" <<"<!DOCTYPE html PUBLIC\"-//W3C//DTD XHTML 1.1//EN\"" <<"\"htp://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">"; cout<<"<html xmlns =\" http://www.w3.org/1999/xhtml \">" <<"<head><title>Bug2Bug Travel</tittle></head><body>"; if (passwordString == "coat2coat") cout<<"<hr/><p>Currnt member special:" <<"Seattle to Tokyo ($400)</p>"; else cout<<"<p>sorry u have entered incorrect password</p>"; cout<<"</body></html>"; return 0; }

  • This Question is Closed
  1. walters
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    1 Attachment
  2. walters
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    actualy my problem is that getenv give me the warnings

  3. KonradZuse
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    you should really do what someone asks you to when they are helping you.

  4. KonradZuse
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    if( getenv("CONTENT_LENGTH") ) contentLength= atoi(getenv("CONTENT_LENGTH")); what is "CONTENT_LENGTH" "getenv" and atoi?

  5. walters
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    atoi it convert string to integer

  6. slotema
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I just compiled your program with g++, but I got no warnings. Could you post the ones that you get?

  7. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy