home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.msdos.programmer
- Path: sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!batcomputer!caen!sdd.hp.com!usc!howland.reston.ans.net!spool.mu.edu!agate!netsys!ukma!news!news.cs.odu.edu!wiggins
- From: wiggins@sirocco.cs.odu.edu (Samuel E Wiggins)
- Subject: question about compiling TC++
- Message-ID: <WIGGINS.93Jan28142329@sirocco.cs.odu.edu>
- Sender: news@cs.odu.edu (News File Owner)
- Nntp-Posting-Host: sirocco.cs.odu.edu
- Organization: Old Dominion University, Norfolk, VA, USA
- Date: Thu, 28 Jan 1993 19:23:28 GMT
- Lines: 26
-
- I'm new to writing programs for IBM PC's with Turbo C++, so please bear with
- me. I'm in the initial stages of writing a program. So far, I've only made a
- a main function that calls this other function which is in another file. What
- The main module doesn't do anything but call the other. It's got like all of
- 5 lines of source code so far. The module it calls, though, uses stdio.h,
- string.h, and conio.h for a bunch of gets() operations to input some things.
- That's basically all these do.
-
- My question is, how come it only works when I compile with the compact or
- larger models? For example, for this code:
- char *s;
- gets(s);
- printf("S is: %s\n",s);
- The last time a gets() is run, it'll print that:
- S is: (null)
- no matter what you type in. BTW, the code is EXACTLY this way. The stuff
- typed in gets lost by the gets() by the time the next line is run. ???
- UNLESS, I compile with the compact or larger model in TC++, in which case the
- problem disappears, WITHOUT touching the code. Now, I know all
- this probably has to do with the amount of memory set aside to allocate
- all the variables and other stuff, but it's a relatively simple program.
- Sheesh! Does it take all this memory and stuff?
-
- Could someone knowledgable please respond?
-
-
-