[comp.sys.mac.programmer] How to write a tab into a file?

juana@dciem.dciem.dnd.ca (Juana Chang) (09/22/90)

Hi.  This is probably (hopefully) a simple question.  How do you write a
tab into a file.

What I need to do is this:

fprintf(File, "...\n", number0, number1, number2, number3);

where the result in the file would be:

number0[tab]number1[tab]number2[tab]number3[return]

and what I need to know is what to put in the format statement of the
fprintf.

Thanks for any help !!!

Juana 

niko@du248-16.cc.iastate.edu (Schuessler Nikolaus E) (09/22/90)

In article <3556@dciem.dciem.dnd.ca> juana@dciem.dciem.dnd.ca (Juana Chang) writes:
>
>Hi.  This is probably (hopefully) a simple question.  How do you write a
>tab into a file.
>
>What I need to do is this:
>
>fprintf(File, "...\n", number0, number1, number2, number3);
>
>where the result in the file would be:
>
>number0[tab]number1[tab]number2[tab]number3[return]
>
>and what I need to know is what to put in the format statement of the
>fprintf.
>
>Thanks for any help !!!
>
>Juana 


Is '\t' the answer you want? There are others:


\b  backspace
\r  cairrage return
\f  form feed
\\  backslash
\ddd any character value specified in octal.





--
------------------------------------------------------------------------------
Niko Schuessler               "On a two semester mission to engineer where
niko@iastate.edu               no-one has engineered before.... :-) "
------------------------------------------------------------------------------

rotberg@dms.UUCP (Ed Rotberg) (09/24/90)

From article <3556@dciem.dciem.dnd.ca>, by juana@dciem.dciem.dnd.ca (Juana Chang):
> What I need to do is this:
> 
> fprintf(File, "...\n", number0, number1, number2, number3);
> 
> where the result in the file would be:
> 
> number0[tab]number1[tab]number2[tab]number3[return]
> 


\t is the TAB character as defined in K & R.

Good Luck.

	- Ed Rotberg -