Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Iran
    Posts
    695
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can I use Cookies as Data Files??

    Hi, I'm a new user and just have a big problem! When I learned cookies, I just thought can I use it like files in C++ or not. I mean putting too much values in them and then retrieving them?

    I wana have an input box with two buttons : Enter and Display.
    The user enters new names in the text area, I put them in the cookie with the setCookie function, and then when he/she clicks on the Display button, I retrieve all the names from the cookie file and show them in a new window, in the following manner:

    Name #1 : .........
    Name #2 : .........
    Name #3 : .........
    .
    .
    .
    .

    My Solution:

    I make my setCookie function, then I call it as setCookie("Number", count, CD() ), "Number" is the name of my variable that never changes, but 'count' holds the number of names' elements. Also CD() is a function that calculates the date of the next year. Then whenever I wana add something to the cookie, I get the value of "Number" by using ( count = getCookie("Number") ), then inceremening count by one, and entering my new data as ( setCookie("Name" + count, Value, CD() ) ).
    But it doesn't work, I have the whole program written and I'm gonna send it now, I put enough description in that, so, saying more here will make it confusing!

    Please take a look at the file and tell me what I can do! thanx in advance...
    Attached Files Attached Files
    Last edited by ConfusedOfLife; 07-05-2002 at 11:32 AM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •