Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!ucbcad!zen!ucbvax!cbosgd!osu-cis!ogg!spencer
From: spencer@ogg.cgrg.ohio-state.edu (Steve)
Newsgroups: comp.lang.c
Subject: fopen and curses clashing when opening a file??
Message-ID: <1014@ogg.cgrg.ohio-state.edu>
Date: Thu, 3-Dec-87 09:41:55 EST
Article-I.D.: ogg.1014
Posted: Thu Dec  3 09:41:55 1987
Date-Received: Tue, 8-Dec-87 02:56:29 EST
Organization: Too far from Anna Maria Island.
Lines: 50
Keywords: fopen curses core dump

Let's get machines out of the way first: this program runs on a Vax, 4.3BSD.

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;

    mf = fopen("mapp","w");                                 
    if (mf==NULL) {
      printf("could not open mapp\n");
    } else {
      printf("opened mapp\n");
      fprintf(mf,"Hello world 1234567890\n");
      fclose(mf);
    }
}
==========================================

 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().  

My question is this:  given what sketchy details I have given, can anyone
figure out WHY this won't work?  Running "dbx" on this program reveals
that it stopped in the fopen() statement, running a function called
Legalfilename(), which in turn was running a function called writev().
(from the "where" command in dbx)  Maybe I'm wrong in assuming that curses
has something to do with it, but frankly, I'm stumped.

My sincere thanks to anyone who can lead me out of this mess.


			  
	      
-- 
"Travis McGee's still in Cedar Key,
  That's what old John MacDonald said...." - Jimmy Buffett

Stephen Spencer, Graduate Student	|
The Computer Graphics Research Group	| {cbosgd,ucbvax}!osu-cis!ogg!spencer
The Ohio State University		| spencer@ogg.cgrg.ohio-state.edu
1501 Neil Avenue, Columbus OH 43210	|