TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Lawrence Lucier
from: Alan Clifford
date: 1996-02-28 23:12:44
subject: File writes

Hello Lawrence

Replying to a message of Lawrence Lucier to All:

 LL>    Hi All! :-)

 LL>    Newbie to C programming here.........using GCC, EMX and Project
 LL> Manager. 

 LL>    Problem:
 LL>    Using the code written below, when a users name is written to the
 LL> disk file, the name element isn't cleared so that parts of other
 LL> names show up.  

 LL>    EG:   if the first name written to the file is Lawrence Lucier and
 LL> the second John Henry, then the first record will hold the name
 LL> "Lawrence Lucier", but the second record will be
"John Henry ier".

'C' will be happy with this because there will be a null byte at the end of
"John Henry" so the rest of the array is ignored.  But you have
written the whole of the structure to the file ie all 36 characters in the
name array.  You could perhaps write space characters to the mtag2.name
array before copying the name to it.

Alan

--- FleetStreet 1.14 NR
* Origin: Alan's Point on Donor/2 (alanc{at}donor2.demon.co.uk) (2:440/4.6)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 440/4 141/209 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.