|
| Joined: Mar 1983 Posts: 55 UGN Elder | UGN Elder Joined: Mar 1983 Posts: 55 | I am trying to make a program in C but am running into problems with my input buffer storing characters that i dont want it to store. Is their a simple way to wipe this buffer clean every time i run though the loop i have it going through?
Regards,
Skull
Trust me, if i started killing people, there'd None of you left
| | |
▼ Sponsored Links ▼
▲ Sponsored Links ▲
| | | Joined: Mar 2002 Posts: 1,273 DollarDNS Owner | DollarDNS Owner Joined: Mar 2002 Posts: 1,273 | yeah, I had a problem with that in my buffer in my telnet router program. Here's what I did: ZeroMemory(&buffer[0], 4096); Full code found at: ftp://serialcoders.sytes.net/Router/TelnetRouter_v3.0.zip | | | | Joined: Mar 1983 Posts: 55 UGN Elder | UGN Elder Joined: Mar 1983 Posts: 55 | Thanks Mr. Rage
An Alternitvie solution that i found is the setbuf(); function in conjuncture with the fflush() funcition. The set buf allows you to use a user defined var as your inputbuffer with a size that you spefify. Then using the fflush() it will flush that buffer retruning the null character to the first slot.
Regards,
Skull
Trust me, if i started killing people, there'd None of you left
| | |
Forums41 Topics33,840 Posts68,858 Members2,176 | Most Online3,253 Jan 13th, 2020 | | | |
|