Saving C as a file to put through a compiler 
Author Message
 Saving C as a file to put through a compiler

Ive just wrote some basic C and I have to put it through acompiler,
not write into it.  Can I save it temporarily as a file, so it will
eventually compile it into a program.

Ideas?
----
Jarto
"Don't believe the news in newspapers that are in a mass circulation. Don't believe that there are newspapers not in mass circulation."-Jarto
"I CAME NOT TO BRING PEACE, BUT AN OBNOXIOUS RADIO SHOW."
-- J.R. "Bob" Dobbs, 1956-ecclesians 6:14.
--



Fri, 30 Sep 2005 12:26:18 GMT  
 Saving C as a file to put through a compiler

Quote:

> Ive just wrote some basic C and I have to put it through acompiler,
> not write into it.  Can I save it temporarily as a file, so it will
> eventually compile it into a program.

What alternative did you have in mind?  It is nearly
universal practice to store program source code in
one or more text files.  Compilers in general
translate from source file(s) to encoded binary
object files, which are then linked along with
run-time support function libraries to produce
executable images, which can then be invoked with
appropriate arguments (and connections to standard
input/output channels) using whatever method is
expected by the target operating system.
--



Sun, 02 Oct 2005 08:23:45 GMT  
 Saving C as a file to put through a compiler

Quote:

> Ive just wrote some basic C and I have to put it through acompiler,
> not write into it.  Can I save it temporarily as a file, so it will
> eventually compile it into a program.

If your compiler is a remotely sensible one: yes you can.  That's actually
the method you *should* be doing it.

For the details of how, *you* will have to consult the documentation
of the compiler *you*'re using, or ask its makers.
--

Even if all the snow were burnt, ashes would remain.
--



Sun, 02 Oct 2005 08:23:51 GMT  
 Saving C as a file to put through a compiler

comp.lang.c.moderated:

Quote:
> Ive just wrote some basic C and I have to put it through acompiler,
> not write into it.  Can I save it temporarily as a file, so it will
> eventually compile it into a program.

> Ideas?

How did you just write some C?  In some sort of text editor or word
processor program?  Or on a piece of paper?

Assuming you wrote it in a text editor, the editor should have some
menu option or keystroke command to save a file.

If you wrote it in a word processor such as AbiWord or Microsoft Word,
there should be a menu option to allow you to save it in a plain text
format.

In either case you will probably have the best results later if you
use a name with an extension of .c.

If you wrote it on a piece of paper, save the paper.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
--



Sun, 02 Oct 2005 08:24:26 GMT  
 Saving C as a file to put through a compiler

Quote:

> Ive just wrote some basic C and I have to put it through acompiler,
> not write into it.  Can I save it temporarily as a file, so it will
> eventually compile it into a program.

Do you have a computer? And operating system?

If no operating system, perhaps a file system with some sort of user
interface?

Do you have a hard disk or a floppy disk? Maybe a connection to a
network that would give you access to a hard disk? Or even a RAM disk?

How about a compiler?

Text editor?

Some way to invoke the compiler?

You DO?

Then the answer is yes.

Quote:
> Ideas?

I have no imagination. Are ideas on topic for this NG?

Quote:
> ----
> Jarto
> "Don't believe the news in newspapers that are in a mass circulation. Don't believe that there are newspapers not in mass circulation."-Jarto
> "I CAME NOT TO BRING PEACE, BUT AN OBNOXIOUS RADIO SHOW."
> -- J.R. "Bob" Dobbs, 1956-ecclesians 6:14.

I BELIEVE!! (or was it i-interleave?)

Anyway, I'd rather not just guess that you are using Project Builder
on Mac OS X and tell you to look in the file menu, the build menu, and
the debug menu.

Sock Puppet #77340
--



Sun, 02 Oct 2005 08:25:53 GMT  
 Saving C as a file to put through a compiler

Quote:

> Ive just wrote some basic C and I have to put it through acompiler,
> not write into it.  Can I save it temporarily as a file, so it will
> eventually compile it into a program.

There is nothing about C programming language.  Try to read your
compiler's manual.

--
Best Regards
Mikhail Vladimirov <vladimirow[at]mail.ru>
--



Sun, 02 Oct 2005 08:26:05 GMT  
 Saving C as a file to put through a compiler
  You should be able to write the code in a text editor (notepad in
windows or joe in linux), save it and then later use the
compiler to actually compile the file with the code and produce a
executable program . But the command that you have
to use to make this depends on your compiler, check the user manual
of the compiler. In linux this should work:

$ gcc -o  name_executable name_code_file

  You should try to find a book that explains all this things, you
will go crazy if you have to ask every simple question in the news group.
--



Sun, 02 Oct 2005 08:26:18 GMT  
 Saving C as a file to put through a compiler

Quote:
> In linux this should work:

> $ gcc -o  name_executable name_code_file

Anw while we are at the basics: Don't call your executable 'test' on unix.
(This is the name of a build in command of the shell which will be invoked instead of your program)
Usually you will give your name_code_file an extension of '.c', e.g. foobar.c

HTH

Martin

P.S.:
Maybe a look at
http://www.eskimo.com/~scs/C-faq/top.html
won't hurt !
--



Mon, 03 Oct 2005 14:53:06 GMT  
 Saving C as a file to put through a compiler

Quote:

> > In linux this should work:

> > $ gcc -o  name_executable name_code_file

> Anw while we are at the basics: Don't call your executable 'test' on unix.
> (This is the name of a build in command of the shell which will be
> invoked instead of your program)

<WAY_OFF_TOPIC>
Actually, if you avoid putting '.' in your $PATH, you can call your
test program whatever you like -- just be sure to execute it as
"./test".
</WAY_OFF_TOPIC>

--

San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
--



Thu, 06 Oct 2005 01:24:39 GMT  
 Saving C as a file to put through a compiler

Quote:

> Anw while we are at the basics: Don't call your executable 'test' on unix.
> (This is the name of a build in command of the shell which will be invoked instead of your program)

Since one should always be invoking programs that are in the
current working directory as ./whatever rather than plain
whatever, it shouldn't be a problem if whatever=test.
--



Thu, 06 Oct 2005 01:25:04 GMT  
 Saving C as a file to put through a compiler

Quote:

> > Anw while we are at the basics: Don't call your executable 'test' on unix.
> > (This is the name of a build in command of the shell which will be
> > invoked instead of your program)

> Since one should always be invoking programs that are in the
> current working directory as ./whatever rather than plain
> whatever, it shouldn't be a problem if whatever=test.

<WAY_WAY_OFF_TOPIC>
Unless you're planning to put the executable somewhere in your $PATH.
</WAY_WAY_OFF_TOPIC>

--

San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
--



Sat, 08 Oct 2005 00:33:34 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Newbie: separate big .cs file into small .cs files

2. Possible to put compiler switches (e.g. /unsafe) in .cs file ?

3. resx files needed for cs - files ??

4. CS files display in VS6 like CPP files ?

5. Compiler error CS 1595 - Help

6. putting end of file character in binary file (cutting the file short)

7. Basic Open File, Save/ Save as functions for dos word processor

8. ! Saving (graphics) to file - saving window contents (PICT) in Code warrior C (on a Mac PPC)

9. How to obtain name of file on Save/Save As

10. How to obtain name of file on Save/Save As

11. Include code in other Cs files

12. Reuse of cs files, namespace, arch advice pls

 

 
Powered by phpBB® Forum Software