I created the simple file text and change the extension .rtf to .c and open with xcode and paste the code and compile just the command -Wall programfile.c -o programfile and it works.
If I understand what you did, then changing the extension from .rtf to .c is probably the cause of the problem.
Text in .rtf files is not stored as plain text. Backslashes have a special meaning. To let you type in backslashes, each literal backslash is actually stored in the RTF file as
two backslashes.
I started with this fragment of C source:
Code:
printf("******************************************************************\n");
printf(" Aeroporto Internacional do Paraiso \n");
printf("******************************************************************\n");
The code is directly from the original uploaded source.
I made a new file in TextEdit and pasted that C code into it. I then saved it as .RTF.
Next, I changed the extension from .RTF to .C and opened it in Xcode. It looks like this:
Code:
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww13300\viewh9000\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\fs24 \cf0
printf("******************************************************************[COLOR="Red"]\\n[/COLOR]");\
printf(" Aeroporto Internacional do Paraiso [COLOR="red"]\\n[/COLOR]");\
printf("******************************************************************[COLOR="red"]\\n[/COLOR]");\
}
I've hilited the double-backslashes in red.
Now, if you copy just the lines of printf's, and paste them into another file in Xcode, it will compile. This isn't a surprise; the code is legal C. However, the double-backslashes will be treated as
literal backslashes by the C compiler. That's how C works. Look in any C reference book about how backslash is used in C strings and characters.
So if the double-backslash code is compiled, it will produce exactly the output appearing in the OP's first screenshot.
One way to avoid this problem is to never change .RTF extensions to .C. There's no reason to do this when simple strategies can safely avoid problems.
One simple approach is to open the .RTF file in Xcode, then copy and paste the lines of code into a .C file. Xcode is able to open RTF files, and copy text out of them. The copied text is the original text, without double backslashes.
Or open the .RTF in TextEdit and "Save as..." a plain text file. Then open the plain text file in Xcode and copy/paste into a .C file.
The simplest solution of all is to never edit code in TextEdit, and certainly never saved as RTF. Just use Xcode's editor for all editing of source files.