TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mike Bilow
from: Lawrence Lucier
date: 1996-03-03 23:31:36
subject: File writes

Hi Mike! :-)

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

 MB> This is not an OS/2 problem, just a C problem.  I recommend
 MB> C_ECHO.

    Hmmm.........maybe I am misunderstanding the reason for this echo then.
 Is there a rules posting for this conference (I haven't seen one as of
yet). :-)

 MB> values.  In cases where this is ambiguous ("\x011\x012\x014NET"),
 MB> you need to use the compiler concatenation facility to remove
 MB> the ambiguity.

     Great and thanks for the tip.

 MB> C considers strings to be null-terminated, so copying char arrays
 MB> which are not null-terminated must use memcpy() rather than
 MB> strcpy().

     Will have to check this out a little further then as the strings were
null terminated when I was using the strcpy() function.  At least I believe
they were while being view with LIST in hex mode (or am I seeing something
else there?).

 MB> Your logic is also messed up, since you will do a write after
 MB> getting EOF.  

    Thanks for pointing this out and you are quite right!  I am
getting the last entry read showing up twice in the rewritten file. :-)


 MB>    while(sizeof(struct username_in) ==          fread(&user,
 MB> sizeof(struct username_in), 1, in)) {

    Great!  Thanks for the code and tips Mike.........much appreciated! :-)

--- Sqed/32 1.00/r15155
* Origin: T-Shirts 'N Genes BBS - (604) 748-3408 v32b v42b XA CM (1:340/204)
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: 340/204 1 3615/50 396/1 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™.