Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #68615

Re: fprintf with /r/n outputs only one line

From Dale <dale@dalekelly.org>
Newsgroups comp.lang.c
Subject Re: fprintf with /r/n outputs only one line
Date 2015-08-28 23:56 -0400
Message-ID <8no02b.im3.17.1@news.alt.net> (permalink)
References <8nnt7k.9dl.19.1@news.alt.net> <1b4mjird1p.fsf@pfeifferfamily.net>

Show all headers | View raw


On 08/28/2015 11:25 PM, Joe Pfeiffer wrote:
> Dale <dale@dalekelly.org> writes:
>
>> thanks in advance for any assistance
>>
>> I am using Ubuntu/Gnome/gcc
>>
>> when I use this line inside three for loops, I get only one line of
>> output instead of 3*3*3, in gnome terminal and in gedit and in emacs
>>
>> fprintf(fp, "%d %d %d/r/n", i, j, k);
>>
>> all the data is there, but /r/n is at the end of the line, I tried /r,
>> /n, and /n/r   in each case the slash and letter is still in the line
>> and there is only one line of output
>>
>> I tried printf directly to gnome terminal and get the same result
>>
>> here is my line of output
>>
>> 0 0 0/r/n0 0 1/r/n0 0 2/r/n0 0 3/r/n0 1 0/r/n0 1 1/r/n0 1 2/r/n0 1
>> 3/r/n0 2 0/r/n0 2 1/r/n0 2 2/r/n0 2 3/r/n0 3 0/r/n0 3 1/r/n0 3 2/r/n0
>> 3 3/r/n1 0 0/r/n1 0 1/r/n1 0 2/r/n1 0 3/r/n1 1 0/r/n1 1 1/r/n1 1
>> 2/r/n1 1 3/r/n1 2 0/r/n1 2 1/r/n1 2 2/r/n1 2 3/r/n1 3 0/r/n1 3 1/r/n1
>> 3 2/r/n1 3 3/r/n2 0 0/r/n2 0 1/r/n2 0 2/r/n2 0 3/r/n2 1 0/r/n2 1
>> 1/r/n2 1 2/r/n2 1 3/r/n2 2 0/r/n2 2 1/r/n2 2 2/r/n2 2 3/r/n2 3 0/r/n2
>> 3 1/r/n2 3 2/r/n2 3 3/r/n3 0 0/r/n3 0 1/r/n3 0 2/r/n3 0 3/r/n3 1
>> 0/r/n3 1 1/r/n3 1 2/r/n3 1 3/r/n3 2 0/r/n3 2 1/r/n3 2 2/r/n3 2 3/r/n3
>> 3 0/r/n3 3 1/r/n3 3 2/r/n3 3 3/r/n
>>
>> here is my program
>>
>> #include <stdio.h>
>>
>>
>> int main()
>> {
>>
>> 	FILE * fp;
>> 	fp = fopen ("ijk.txt", "w");
>>
>> 	int i;
>> 	int j;
>> 	int k;
>>
>> 	for(i=0; i <= 3; i++)
>> 	{
>> 		for(j=0; j <= 3; j++)
>> 		{
>>
>> 			for(k=0; k <= 3; k++)
>> 			{
>>
>> 			fprintf(fp, "%d %d %d/r/n", i, j, k);
>>
>> 			}
>> 		
>> 		}
>> 	
>> 	}
>>
>> 	fclose(fp);
>> 	return(0);
>>
>> }
>
> Try \ instead of /
>

worked, thanks a lot


-- 
Dale
http://www.dalekelly.org

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

fprintf with /r/n outputs only one line Dale <dale@dalekelly.org> - 2015-08-28 23:08 -0400
  Re: fprintf with /r/n outputs only one line Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-08-28 21:25 -0600
    Re: fprintf with /r/n outputs only one line Dale <dale@dalekelly.org> - 2015-08-28 23:56 -0400
  Re: fprintf with /r/n outputs only one line James Kuyper <jameskuyper@verizon.net> - 2015-08-28 23:34 -0400
    Re: fprintf with /r/n outputs only one line Dale <dale@dalekelly.org> - 2015-08-29 00:02 -0400
      Re: fprintf with /r/n outputs only one line Johann Klammer <klammerj@NOSPAM.a1.net> - 2015-08-29 06:51 +0200
        Re: fprintf with /r/n outputs only one line Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-08-29 07:30 +0000
        Re: fprintf with /r/n outputs only one line Keith Thompson <kst-u@mib.org> - 2015-08-29 01:23 -0700
      Re: fprintf with /r/n outputs only one line James Kuyper <jameskuyper@verizon.net> - 2015-08-29 11:22 -0400
        Re: fprintf with /r/n outputs only one line glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-29 16:59 +0000
      Re: fprintf with /r/n outputs only one line Geoff <geoff@invalid.invalid> - 2015-08-30 11:40 -0700
        Re: fprintf with /r/n outputs only one line Keith Thompson <kst-u@mib.org> - 2015-08-30 15:17 -0700
          Re: fprintf with /r/n outputs only one line Geoff <geoff@invalid.invalid> - 2015-08-30 16:21 -0700
            Re: fprintf with /r/n outputs only one line James Kuyper <jameskuyper@verizon.net> - 2015-08-30 19:45 -0400
  Re: fprintf with /r/n outputs only one line Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-29 14:51 +0100
    Re: fprintf with /r/n outputs only one line Ayan <selfjam@gmail.com> - 2015-08-29 10:24 -0400
      Re: fprintf with /r/n outputs only one line James Kuyper <jameskuyper@verizon.net> - 2015-08-29 11:27 -0400
      Re: fprintf with /r/n outputs only one line Ayan <selfjam@gmail.com> - 2015-08-29 14:31 -0400
      Re: fprintf with /r/n outputs only one line Keith Thompson <kst-u@mib.org> - 2015-08-29 13:31 -0700
    Re: fprintf with /r/n outputs only one line Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-29 16:03 +0100
      Re: fprintf with /r/n outputs only one line Ike Naar <ike@iceland.freeshell.org> - 2015-08-29 16:50 +0000
        Re: fprintf with /r/n outputs only one line Ike Naar <ike@iceland.freeshell.org> - 2015-08-29 17:05 +0000
          Re: fprintf with /r/n outputs only one line Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-29 19:39 +0100
            Re: fprintf with /r/n outputs only one line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-29 14:05 -0700
              Re: fprintf with /r/n outputs only one line Bartc <bc@freeuk.com> - 2015-08-29 22:46 +0100
                Re: fprintf with /r/n outputs only one line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-29 15:59 -0700
                Re: fprintf with /r/n outputs only one line Bartc <bc@freeuk.com> - 2015-08-30 00:31 +0100
                Re: fprintf with /r/n outputs only one line Bartc <bc@freeuk.com> - 2015-08-30 10:25 +0100
                Re: fprintf with /r/n outputs only one line Bartc <bc@freeuk.com> - 2015-08-30 13:22 +0100
                Re: fprintf with /r/n outputs only one line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-31 03:18 -0700
                Re: fprintf with /r/n outputs only one line Bartc <bc@freeuk.com> - 2015-08-31 11:58 +0100
                Re: fprintf with /r/n outputs only one line Bartc <bc@freeuk.com> - 2015-08-31 13:38 +0100
                Re: fprintf with /r/n outputs only one line glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-09-04 04:18 +0000
                Re: fprintf with /r/n outputs only one line "Charles Richmond" <numerist@aquaporin4.com> - 2015-09-04 05:09 -0500
                Re: fprintf with /r/n outputs only one line Robert Wessel <robertwessel2@yahoo.com> - 2015-09-04 05:19 -0500
                Re: fprintf with /r/n outputs only one line raltbos@xs4all.nl (Richard Bos) - 2015-09-04 16:33 +0000
              Re: fprintf with /r/n outputs only one line Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-30 02:17 +0100
                Re: fprintf with /r/n outputs only one line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-29 23:43 -0700
                Re: fprintf with /r/n outputs only one line Geoff <geoff@invalid.invalid> - 2015-08-30 11:47 -0700
                Re: fprintf with /r/n outputs only one line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-30 13:18 -0700
                Re: fprintf with /r/n outputs only one line Geoff <geoff@invalid.invalid> - 2015-08-30 16:04 -0700
              Re: fprintf with /r/n outputs only one line Ike Naar <ike@iceland.freeshell.org> - 2015-08-30 07:20 +0000
              Re: fprintf with /r/n outputs only one line Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-06 15:17 -0700
                Re: fprintf with /r/n outputs only one line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-06 16:36 -0700
                Re: fprintf with /r/n outputs only one line Tim Rentsch <txr@alumni.caltech.edu> - 2015-09-07 23:19 -0700
                Re: fprintf with /r/n outputs only one line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-09-08 02:50 -0700
            Re: fprintf with /r/n outputs only one line Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-30 02:14 +0100

csiph-web