Thread: using an operating system command in c

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    16

    using an operating system command in c

    Hello all,

    I am new to the forum and C as a programming language.

    I am a student in college in my second programming course this year (First was VB.NET)

    I did read the sticky about homework and no worries I am not looking for someone to write my program just answer a question about how to do a particular function.

    One of the programs I have to write for my first assignment (summer semester) is a simple trip calculator, Take in the price of fuel, the kilometers (we're in Canada) of your trip, calculate mileage based on liters/100Km and spit out the cost of the fuel for the trip. That part of the assignment is done I am working to make it a little more of a "real" program. I have included a loop and decisions based on input to prevent invalid output or crashes.

    I should mention I am programming in/on Linux (fedora core 5) coding in the text editior and running and compiling programs in a terminal window.

    What I want to do in my program is call the linux command clear to clear the terminal screen so only the current running program is shown. otherwise all the commands to change to the approprite directory, complie and run are in the screen when my program starts and it just looks messy.

    My understanding is I need to call another include file other than stdio.h

    does anyone know the include I need to call and maybe have some example code of using an operating system command.

    one more quick question, I am compling with gcc using the command
    gcc filename.c -o executeablename I read elsewhere that in order to compile with a second include I have to change my gcc arguments?

    Thanks in advance for any assistance, and sorry for being long winded.

    clearrtc

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    16
    Thanks for the link, stdlib.h and the system command. It worked great.

    Thanks again

    clearrtc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL and my operating system
    By hauzer in forum C Programming
    Replies: 5
    Last Post: 10-31-2008, 12:16 PM
  2. Operating System Project
    By Pete in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 07-15-2004, 09:33 AM
  3. What is a Microsoft Operating System Like?
    By Troll_King in forum A Brief History of Cprogramming.com
    Replies: 35
    Last Post: 10-21-2002, 07:36 AM
  4. Operating system
    By sopranosomega in forum C Programming
    Replies: 6
    Last Post: 10-07-2002, 06:12 AM
  5. Microsoft = The Best Operating System
    By Troll_King in forum A Brief History of Cprogramming.com
    Replies: 92
    Last Post: 02-08-2002, 01:32 PM