Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.pascal.borland    |    Borland Pascal was actually pretty neat    |    2,978 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 2,153 of 2,978    |
|    Femme Verbeek to jaf.2k@ntlworld.com    |
|    Re: Password    |
|    29 Apr 06 03:22:59    |
      From: fv@nospam.tcenl.com              jaf.2k@ntlworld.com schreef:       > Hi I'm currently doing a password system. I've got it working. But I'd       > like to know how this bit works. I knew how my original password system       > worked as it was simple with no option to delete characters. I saw       > pieces of code on here that regarded deleting. The first IF section is       > fine, and I understand that, but how does dec(password[0]) work.       > Decrement the password variable with the [0] followed after it. What       > does the 0 mean? How does dec(password[0]) remove a character from the       > password string? I would be grateful if someone could tell me about       > this, it's probably very simple.       >       > IF (pass_char = #08) THEN       > BEGIN       > layout details blah blah blah       > remove asterisks       > put cursor back in right place ready for next character after deletion       > of previous character       >       > IF length(password) > 0 THEN       > BEGIN       > dec(password[0]);       > END;       >              It helps a lot to understand how a pascal string works.       A string declaration reserves 256 bytes on the heap.       It is actually an array [0..255] of char.       The length of the data contained in the string is stored in the 0th       byte, the data itself in bytes 1 to 255.              So decrementing Password[0] by one effectively removes the last char       from the string.              -- Femme              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca