🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #510

Re: MY problem? ...or Borland's? (also on comp.lang.c)

#510
From: Yevgeny Gurevich
Date: Mon, 27 Jul 1992 13:32
36 lines
1895 bytes
In article <1992Jul25.163852.19770@uwm.edu> rca@csd4.csd.uwm.edu (Robert C Allender) writes:
> . . .  values get corrupt and then dissappear.  What am I doing wrong?

In cases such as these, always check to make sure that you are allocating
memory for data storage, and that you are not inadvertantly freeing it.
In this case, you haven't yet done a  malloc, so c, the pointer to a char
points to some random location in memory which may or may not be in use.

>main() {
>  char drive, *c;
>  char dummy;
>
.
.
.
>
>  do {
>    do {
>      drive=get_drive();
>    } while (drive == NULL);
>    c = scrollbox(drive,61,10);  <---- This gets a directory, etc. 
     ^^^^^^^^^^^^^
Are you sure that scrollbox allocates string storage ?  Please post the
code for this procedure.
Otherwise, try allocating memory for c with malloc and see if that
is what the problem was.

[===============================================================]
[ Yevgeny Gurevich	   ___/~\____/~\_/~~~~\__/~\______/~\_  ]
[ 500 Memorial Drive	  |____/~\__/~\__/~\______/~\____/~\__| ]
[ Cambridge, Mass. 02139  |_____/~\/~\___/~~~\_____/~\__/~\___| ]
[ ________________________|______/~~\____/~\________/~\/~\____| ]
[ yev_g@athena.mit.edu    |______/~~\____/~~~~\______/~~\_____| ]
[===============================================================]
-- 
[ Yevgeny Gurevich ]
Technical Details
Message-ID: <1992Jul27.133223.8072@athena.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!gatech!bloom-beacon!bloom-picayune.mit.edu!yev_g
References: <1992Jul25.163852.19770@uwm.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!gatech!bloom-beacon!bloom-picayune.mit.edu!yev_g
From: yev_g@athena.mit.edu (Yevgeny Gurevich)
Newsgroups: comp.os.msdos.programmer
Subject: Re: MY problem? ...or Borland's? (also on comp.lang.c)
Message-ID: <1992Jul27.133223.8072@athena.mit.edu>
Date: 27 Jul 92 13:32:23 GMT
References: <1992Jul25.163852.19770@uwm.edu>
Sender: news@athena.mit.edu (News system)
Organization: Massachusetts Institute of Technology
Lines: 36
Nntp-Posting-Host: courbet.mit.edu