CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2009
    Posts
    24

    Need to create a simple file replication program in Linux.. need major help.

    Alright.. so I've been given this assignment to create a File Replication program that will allow a user to create, delete, read, write, and close a file through a text menu. It's been a long time since I've programmed, so I honestly have no idea where to start and how to go about doing this.

    Here is the entire assignment sheet which details what I need to do:
    http://dharmeshcpatel.com/project2.pdf

    I've never programmed in Linux, so I guess setting up the text menu would be a good start.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Need to create a simple file replication program in Linux.. need major help.

    Quote Originally Posted by dpatel304 View Post
    I've never programmed in Linux, so I guess setting up the text menu would be a good start.
    It is not a good start. All you would be doing is wasting a lot of time getting nice looking menu working, and the important part of the program, i.e. manipulating a file, would go undone. I read your assignment, and honestly, the first part about the menu should be the last thing you should be working on.

    The first thing you should do is learn how to manipulate a file. Then it doesn't matter what menu or what input mechanism you come up with to manipulate the file.
    Code:
    #include <cstdio>
    
    int CreateFile( )
    {
    }
    
    int CopyFile()
    {
    }
    
    int main()
    {
       CreateFile();  //etc
    }
    Once you create these functions. then you test them with a simple program. Once you have convinced yourself that you can create, move, copy, etc. a file, then you write a program based on these functions. You don't go waste time on GUI, and then when the deadline gets hit, your program doesn't do anything except display some nice text.

    If your program only shows a menu that doesn't do anything, you should get 0 or minimum points -- any novice programmer can make a menu with nice looking text. If you have a program that contains functions that manipulate files correctly, as stated by your assignment, and you didn't finish the menu (but the functions do work when you call them), then you get a majority of the points. The reason being that he important part of the program was completed. A mistake that a lot of beginners make is waste time on GUI, I/O, etc. and then run out of time actually making the program do the important, real work of the assignment -- in your case it's manipulating files.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; August 3rd, 2010 at 09:23 PM.

  3. #3
    Join Date
    Jul 2011
    Posts
    1

    Re: Need to create a simple file replication program in Linux.. need major help.

    Hi dpatel304,

    so I stuck in the same programming assignment and somewhat similar situation as yours. I have been programming in Java and Python and minimal experience programming in C using Linux. I would appreciate if you have this program on your and would like to share it with me so I can get help with it.
    Email: [email protected]

    Thanks in advance.

    Danny

  4. #4
    Join Date
    May 2009
    Location
    Boston
    Posts
    375

    Re: Need to create a simple file replication program in Linux.. need major help.

    Quote Originally Posted by dpatel304 View Post
    Alright.. so I've been given this assignment to create a File Replication program that will allow a user to create, delete, read, write, and close a file through a text menu. It's been a long time since I've programmed, so I honestly have no idea where to start and how to go about doing this.

    Here is the entire assignment sheet which details what I need to do:
    http://dharmeshcpatel.com/project2.pdf

    I've never programmed in Linux, so I guess setting up the text menu would be a good start.
    What are you gong to be using for your programming tools? If you are in linux, or windows cygwin, you can just use the bash shell and a text editor. I like gedit, and vim, but there is also emacs, nano, and others. You can also use an IDE, which combines allot of programming tools into a single gui platform. If you are short on time, learning how to use an IDE may not be the best choice

    You need to make sure that your linux environment is configured for programming, that is to say make sure you have all the right packages installed. It would help if you would post the distro and version of linux you are using. I think you need to start by writing, compiling, and linking a very simple program that does nothing but print some test to the screen just to make sure your environment is properly configured..

    Post back if you want help with that.

    LMHmedchem
    Last edited by LMHmedchem; July 10th, 2011 at 12:44 PM.

  5. #5
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: Need to create a simple file replication program in Linux.. need major help.

    THread is a year old, resurected by reqquest for work.
    Is your question related to IO?
    Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
    It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.

  6. #6
    Join Date
    May 2009
    Location
    Boston
    Posts
    375

    Re: Need to create a simple file replication program in Linux.. need major help.

    Quote Originally Posted by monarch_dodra View Post
    THread is a year old, resurected by reqquest for work.
    Wouldn't a PM have been a better option?

    LMHmedchem

  7. #7
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: Need to create a simple file replication program in Linux.. need major help.

    Quote Originally Posted by LMHmedchem View Post
    Wouldn't a PM have been a better option?
    The post wasn't specifically targeted at you. It was so that other users would take it into account before replying.
    Is your question related to IO?
    Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
    It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured