Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

c compile

Posted on 1999-06-24
1
Medium Priority
?
184 Views
Last Modified: 2013-12-15
hello,

im new to linux, i tried to compile the following code with the command "gcc -o test test.c"

  #include
 
  main ()
  {
    printf("Hello");
  }

the program compiled but when i run the program, nothing happens. I want to program to print in the command promt, how is this done?

thanks
0
Comment
Question by:spat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
gunny051499 earned 400 total points
ID: 1628878
#include <stdio.h>

main()
{
        printf("Hello world!\n");
        exit(0);
}

to print the command prompt, either print it as a fixed string, or get the environment variable PS1 (function "getenv" - see manualpage "man getenv"), interprete it and print it out correctly. this however will be up to you ;)
0

Featured Post

Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Fine Tune your automatic Updates for Ubuntu / Debian
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question