delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/21/17:19:06

From: "Chris Jones" <cj7 AT ukc DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: append to a file
Date: Mon, 21 Feb 2000 18:20:39 -0000
Organization: University of Kent at Canterbury
Lines: 15
Message-ID: <88rvjt$gv8$1@spruce.ukc.ac.uk>
References: <38b17e92$0$82782 AT SSP1NO17 DOT highway DOT telekom DOT at>
NNTP-Posting-Host: stue20c.ukc.ac.uk
X-Trace: spruce.ukc.ac.uk 951157181 17384 129.12.226.12 (21 Feb 2000 18:19:41 GMT)
X-Complaints-To: news AT ukc DOT ac DOT uk
NNTP-Posting-Date: 21 Feb 2000 18:19:41 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> I want to append 128Byte on a file, so I open with
>
> char string[126];
> FILE *f = fopen(file, "a");
> fprintf(f,"TAG%-125s", string);
> fclose(f);
>
> Why doesn't it write anything to file?

Perhaps you should put something in the string - even just
char string[126] = " ";
because an uninitalized string could screw up printf.



- Raw text -


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