Home Forums C Programming Beginner’s help

Viewing 1 reply thread
  • Author
    Posts
    • #2084
      Ms.R
      Participant

      I am new to C, literally. My lovely professor wants us to teach ourselves to program while he compiles it and tells us we’re wrong without going into any details. If it compiles and it runs = A, if it doesn’t = F. There’s no inbetween. By the way, this is to be compiled using “gcc” in an UNIX environment

      part a:
      First of all, you are supposed to write a program in either C or C++ that reads data from a file and copies it to another file. Your program should copy all contents of the file.

      part b:
      Secondly, write another program to create child processes from your main program recursively using fork( ) and exec( ) commands up to a certain level, for example, fifth level. Then print identification of each child process in each level.

      My code:
      Part A:Code:

      Please helpe me?!!?! What am I doing wrong? What am I missing? This guy told me it’d be easy because I “know” Java and it isn’t. I honestly think learning Ada was a lot easier than C.

    • #3370
      Humayan
      Participant

      For the first part you could do:
       

Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.