Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to run a 'c' code?

Subject: how to run a 'c' code?

From: Emma Robertson

Date: 11 Oct, 2011 09:32:19

Message: 1 of 5

Hi all,

I have a 'c' code which I want to run. I am using Mac OSX and have downloaded Xcode, TextMate and Editra. Can someone please advice of the steps required to run the code either in Matlab or any other package.

Many thanks,
Emma

Subject: how to run a 'c' code?

From: Torsten

Date: 11 Oct, 2011 10:39:22

Message: 2 of 5

On 11 Okt., 11:32, "Emma Robertson" <m...@hotmail.co.uk> wrote:
> Hi all,
>
> I have a 'c' code which I want to run.  I am using Mac OSX and have downloaded Xcode, TextMate and Editra. Can someone please advice of the steps required to run the code either in Matlab or any other package.
>
> Many thanks,
> Emma

Does this help ?

http://hintsforums.macworld.com/archive/index.php/t-3404.html

So in principle:

1. In the terminal window, change to the directory where the c-program
is located.
2. If the program's name is program.c, type:
   cc program.c
   A file named a.out should be created in the directory.
3. Execute the program by typing
   ./a.out

Best wishes
Torsten.




Best wishes
Torsten.

Subject: how to run a 'c' code?

From: Emma Robertson

Date: 11 Oct, 2011 11:14:10

Message: 3 of 5

Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message <ee36159d-967b-42c9-96dc-5acf8d3e2759@de2g2000vbb.googlegroups.com>...
> On 11 Okt., 11:32, "Emma Robertson" <m...@hotmail.co.uk> wrote:
> > Hi all,
> >
> > I have a 'c' code which I want to run.  I am using Mac OSX and have downloaded Xcode, TextMate and Editra. Can someone please advice of the steps required to run the code either in Matlab or any other package.
> >
> > Many thanks,
> > Emma
>
> Does this help ?
>
> http://hintsforums.macworld.com/archive/index.php/t-3404.html
>
> So in principle:
>
> 1. In the terminal window, change to the directory where the c-program
> is located.
> 2. If the program's name is program.c, type:
> cc program.c
> A file named a.out should be created in the directory.
> 3. Execute the program by typing
> ./a.out
>
> Best wishes
> Torsten.
>
>
>
>
> Best wishes
> Torsten.

Many thanks for your input. I will try what you've suggested.

Subject: how to run a 'c' code?

From: Emma Robertson

Date: 11 Oct, 2011 11:34:11

Message: 4 of 5

Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message <ee36159d-967b-42c9-96dc-5acf8d3e2759@de2g2000vbb.googlegroups.com>...
> On 11 Okt., 11:32, "Emma Robertson" <m...@hotmail.co.uk> wrote:
> > Hi all,
> >
> > I have a 'c' code which I want to run.  I am using Mac OSX and have downloaded Xcode, TextMate and Editra. Can someone please advice of the steps required to run the code either in Matlab or any other package.
> >
> > Many thanks,
> > Emma
>
> Does this help ?
>
> http://hintsforums.macworld.com/archive/index.php/t-3404.html
>
> So in principle:
>
> 1. In the terminal window, change to the directory where the c-program
> is located.
> 2. If the program's name is program.c, type:
> cc program.c
> A file named a.out should be created in the directory.
> 3. Execute the program by typing
> ./a.out
>
> Best wishes
> Torsten.
>
>
>
>
> Best wishes
> Torsten.

Torsten,
I had a look at the link you provided.
But, what is "./a.out"? where do I put the filename?
Also, am I supposed to get an output (provided there are no errors), say a Figure, when I just type "cc filename.c"?
Thanks

Subject: how to run a 'c' code?

From: HB

Date: 11 Oct, 2011 11:59:53

Message: 5 of 5

On 11 Okt., 13:34, "Emma Robertson" <m...@hotmail.co.uk> wrote:
> Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message <ee36159d-967b-42c9-96dc-5acf8d3e2...@de2g2000vbb.googlegroups.com>...
> > On 11 Okt., 11:32, "Emma Robertson" <m...@hotmail.co.uk> wrote:
> > > Hi all,
>
> > > I have a 'c' code which I want to run.  I am using Mac OSX and have downloaded Xcode, TextMate and Editra. Can someone please advice of the steps required to run the code either in Matlab or any other package.
>
> > > Many thanks,
> > > Emma
>
> > Does this help ?
>
> >http://hintsforums.macworld.com/archive/index.php/t-3404.html
>
> > So in principle:
>
> > 1. In the terminal window, change to the directory where the c-program
> > is located.
> > 2. If the program's name is program.c, type:
> >    cc program.c
> >    A file named a.out should be created in the directory.
> > 3. Execute the program by typing
> >    ./a.out
>
> > Best wishes
> > Torsten.
>
> > Best wishes
> > Torsten.
>
> Torsten,
> I had a look at the link you provided.
> But, what is "./a.out"? where do I put the filename?
> Also, am I supposed to get an output (provided there are no errors), say a Figure, when I just type "cc filename.c"?
> Thanks- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Hi Emma,
a.out it the actual program executable. When you use the c compiler
and don't specify another output name, it uses a.out as default.
If you use cc with a specified output, like
cc -o myProgram program.c
the executable file would be myProgram instead of a.out

By typing ./.a.out you will actually execute the program, as Torsten
pointed out.
Then, after execution of a.out you should have your output figure in
that folder, given that's what the program does and there were no
errors.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us