delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/19/01:24:14

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 18 Mar 2004 22:23:48 -0800
From: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: seg fault on file write in cygwin, please help!!!
Message-ID: <20040319062348.GA3156@efn.org>
References: <1079660146 DOT 405a4e72c44f0 AT webmail DOT mit DOT edu>
Mime-Version: 1.0
In-Reply-To: <1079660146.405a4e72c44f0@webmail.mit.edu>
User-Agent: Mutt/1.4i
Organization: bs"d
X-IsSubscribed: yes

On Thu, Mar 18, 2004 at 08:35:46PM -0500, scyudits wrote:
> FILE *outfile = fopen("/home/Sophia/ns-allinone-2.27/ns-2.27/myfile.tcl", "w");

     check here if fopen failed (outfile will be NULL)

> fprintf(outfile, "%s", output);
> 
> ...where output is a regular string (character array). 

A string is not a character array.  A string is a null-terminated
sequence of characters.  Does output have a null character at the end?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019