Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Evil Bill

CGI & Cookies (C++)

This topic is 5684 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i'm having more than a little difficulty with cookies in my CGI program. The program is written in C++, running under Apache. I've sent a "Set-Cookie:" line, but no cookie is created (i've emptied out my cookies folder to check). Heres my code:
    
int main(int argc, char* argv[])
{
char szBuff[4096];
int nLen;
   
   printf("Set-Cookie: username=Steve;\n");
   printf("Content-type: text/html\n\n");
   printf("<html><body>");
   
   int nLen = fread(szBuff,1,4096,stdin);
   szBuff[nLen] = 0;
   
   printf("%s (%d)",szBuff,nLen);

   printf("<br><a href=\"CookieTest.exe\">Click</a>");
   printf("</body></html>\n");
   return 0;
}
    
I've tried setting the "domain=" part, but that has no effect either. Edit: Oh, and nothing is displayed apart from "(0)" and the "Click Here" link. Any ideas? [edited by - Evil Bill on December 2, 2002 4:36:27 PM]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!