Thread: Need C Help :(

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    5

    Need C Help :(

    I was working on a C program command interpreter where I have to deal with fork and other commands.
    I wrote the program and also initiated the run command in it.
    Now I am not being able to initiate a copy function in it.
    So, please help me with this.
    I have attached my source file.
    If possible, could you make it work?

    here is what I need to do?
    COPY command takes two additional arguments, the source(file to be copied) and the destination(file to be created).
    The syntax is
    COPY source destination

    Algorithm is:
    Open the source file for input
    Open the destination file for output
    For each character in the source file
    Read the character from the source
    Write the character to destination
    Close the source file
    Close the destination file.
    Attached Files Attached Files

  2. #2
    -bleh-
    Join Date
    Aug 2010
    Location
    somewhere in this universe
    Posts
    463
    You'll have better luck posting the code with a codetag. And noone here will write any code for you. You have to write your own code, and we will help you correct it.
    Last edited by nimitzhunter; 04-10-2011 at 03:05 PM.
    "All that we see or seem
    Is but a dream within a dream." - Poe

  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    5
    What is a codetag?

    Also I really have no clue on how to get started with the copy function.
    Any suggestions?

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    I guessed you missed this in your zeal... << !! Posting Code? Read this First !! >>

    I had a look at your file... It's C++ code, all jammed up on one line without a linebreak in sight.

    So... you probably should read the link above then repost this in the C++ forum.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed