Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!poetry
From: poetry@utgpu.UUCP
Newsgroups: comp.lang.c
Subject: Re: fopen and curses clashing when opening a file??
Message-ID: <1987Dec8.081209.1549@gpu.utcs.toronto.edu>
Date: Tue, 8-Dec-87 08:12:09 EST
Article-I.D.: gpu.1987Dec8.081209.1549
Posted: Tue Dec  8 08:12:09 1987
Date-Received: Sun, 13-Dec-87 02:07:52 EST
References: <1014@ogg.cgrg.ohio-state.edu>
Reply-To: poetry@gpu.utcs.UUCP (i.e.)
Distribution: na
Organization: University of Toronto Computing Services
Lines: 40
Keywords: fopen curses core dump
Checksum: 11743


In article <1014@ogg.cgrg.ohio-state.edu> spencer@ogg.cgrg.ohio-state.edu (Steve) writes:

>I am writing an program which utilizes curses (so that I link with
>the curses and termcap libraries).  My problem is this: when I try to
>open a file to write to it (create the file anew), I get a core dump.
>When I make the function which opens the file and writes to it a 
>stand-alone program, it works fine.  The function, in the form of the
>stand-alone program, is shown below:
>===========================================
>#include 
>                        
>main()
>{
>FILE *mf;
>		/* body of the function using printf, etc. */
>}
>==========================================

What alerted my attention is the .  I did some curses
programming in the summer (haven't touched it since) in a different 
environment and I vaguely remember having had a similar problem.

> is included in the program I am writing, and the only other 
>change I made to make this program a function is change the name from
>main() to printmap().  

Precisely.  "You can't mix windows with regular output functions such as
printf() because refresh() doesn't know what those output functions did
or even that they were called."  (quote from John Strang: Programming
with Curses)

I think this is where the problem is.

In addition to the source above, 
	S.G. Kochan + P.H. Wood: Topics in 'C' Programming
has an excellent discussion of curses (and much more; one of the few truly
great books on 'C').

					i.e.