Message-ID: <34DF6028.348D@quantum.de> Date: Mon, 09 Feb 1998 20:59:36 +0100 From: Tom Chojnacki Reply-To: chojnack AT quantum DOT de Organization: Quantum Software GmbH, Dortmund, Germany MIME-Version: 1.0 To: JODE CC: djgpp AT delorie DOT com Subject: Re: Doing wrong! But where? References: <34df149c DOT 11485161 AT news DOT hiway DOT fi> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk JODE wrote: > > ************************************************** > > struct Man { > > char stick[1]; > > }man1; > > fgets(man1.stick, 1, thefile1); > > printf("%C\n", man1.stick); > > ***************************************************** > > The thefile1 first line contains only a single "Y" charracter! > I just can't get it right! The printf prints something realy wierd! > Where do I do wrong? printf("%C\n", man1.stick); ^^ <- here is your problem You should use '%s' format specification type to print the string. Or, if you want to print just first character of it use something like that: printf("%c\n", (man1.stick)[0]); 'stick' member of 'man1' structure is array of characters. Its length is one but it is array! You made confused printf function because it 'thought' that it received an character (%c) and actually it received an array. Hope that helps! Tom