home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / msdos / programm / 8111 < prev    next >
Encoding:
Text File  |  1992-07-27  |  1.8 KB  |  49 lines

  1. Path: sparky!uunet!dtix!darwin.sura.net!gatech!bloom-beacon!bloom-picayune.mit.edu!yev_g
  2. From: yev_g@athena.mit.edu (Yevgeny Gurevich)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: MY problem? ...or Borland's? (also on comp.lang.c)
  5. Message-ID: <1992Jul27.133223.8072@athena.mit.edu>
  6. Date: 27 Jul 92 13:32:23 GMT
  7. References: <1992Jul25.163852.19770@uwm.edu>
  8. Sender: news@athena.mit.edu (News system)
  9. Organization: Massachusetts Institute of Technology
  10. Lines: 36
  11. Nntp-Posting-Host: courbet.mit.edu
  12.  
  13. In article <1992Jul25.163852.19770@uwm.edu> rca@csd4.csd.uwm.edu (Robert C Allender) writes:
  14. > . . .  values get corrupt and then dissappear.  What am I doing wrong?
  15.  
  16. In cases such as these, always check to make sure that you are allocating
  17. memory for data storage, and that you are not inadvertantly freeing it.
  18. In this case, you haven't yet done a  malloc, so c, the pointer to a char
  19. points to some random location in memory which may or may not be in use.
  20.  
  21. >main() {
  22. >  char drive, *c;
  23. >  char dummy;
  24. >
  25. .
  26. .
  27. .
  28. >
  29. >  do {
  30. >    do {
  31. >      drive=get_drive();
  32. >    } while (drive == NULL);
  33. >    c = scrollbox(drive,61,10);  <---- This gets a directory, etc. 
  34.      ^^^^^^^^^^^^^
  35. Are you sure that scrollbox allocates string storage ?  Please post the
  36. code for this procedure.
  37. Otherwise, try allocating memory for c with malloc and see if that
  38. is what the problem was.
  39.  
  40. [===============================================================]
  41. [ Yevgeny Gurevich       ___/~\____/~\_/~~~~\__/~\______/~\_  ]
  42. [ 500 Memorial Drive      |____/~\__/~\__/~\______/~\____/~\__| ]
  43. [ Cambridge, Mass. 02139  |_____/~\/~\___/~~~\_____/~\__/~\___| ]
  44. [ ________________________|______/~~\____/~\________/~\/~\____| ]
  45. [ yev_g@athena.mit.edu    |______/~~\____/~~~~\______/~~\_____| ]
  46. [===============================================================]
  47. -- 
  48. [ Yevgeny Gurevich ]
  49.