From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: Doing wrong! But where? Date: Wed, 11 Feb 1998 09:16:10 -0800 Organization: Alcyone Systems Lines: 33 Message-ID: <34E1DCDA.2C42C02@alcyone.com> References: <34df149c DOT 11485161 AT news DOT hiway DOT fi> NNTP-Posting-Host: 165.90.20.242 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk JODE wrote: > struct Man { > > char stick[1]; > > }man1; > > fgets(man1.stick, 1, thefile1); > > printf("%C\n", man1.stick); There are two problems here. First, fgets always keeps the buffer NUL-terminated, so fgets will never read any data. Perhaps you meant to use read, if you don't want the data to be NUL-terminated (which it can't be since there's only room for the NUL itself and no other data). Second, in the context of this program (note it still won't work because of the above problem), you're passing the address of man1.stick to printf and trying to print it as a character (which is the %c format specifier, not %C). You meant: printf("%c\n", man1.stick[0]); Again, though, because of the above problem, changing this won't help. -- Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com Alcyone Systems / http://www.alcyone.com/max/ San Jose, California, United States / icbm://+37.20.07/-121.53.38 \ "Life may be / the product of imperfections." / (Marclo Gleiser)