• Advertisement


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

CGI & Cookies (C++)

This topic is 5584 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");
   int nLen = fread(szBuff,1,4096,stdin);
   szBuff[nLen] = 0;
   printf("%s (%d)",szBuff,nLen);

   printf("<br><a href=\"CookieTest.exe\">Click</a>");
   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