Advice on an approach to a problem

Discussion in 'C Programming' started by Pinnerite, May 16, 2013.

  1. Pinnerite

    Pinnerite Guest

    I make great use of a 'C' program written by someone else. It works
    invisibly but creates files named by itself. I would like to grant the user
    the option to create their own filenames and the paths for the created
    files.

    My question is in which environment to tackle this: C or C++?
    I have not programmed for some time but keep up to date as best I can. I
    have a limited experience in using OO languages but I do not want to devote
    myself into becoming an expert in either language just getting to grips with
    the bits that I need for this exercise.

    I should add that this is a Linux exercise.

    Any suggestions? TIA

    --
    ___________________________________________________

    Mageia 2 for x86_64, Kernel: 3.4.34-desktop-1.mga2
    KDE version 4.8.5 Running on an AMD 4-core processor
     
    Pinnerite, May 16, 2013
    #1
    1. Advertising

  2. Pinnerite

    Jorgen Grahn Guest

    On Thu, 2013-05-16, Pinnerite wrote:
    > I make great use of a 'C' program written by someone else. It works
    > invisibly but creates files named by itself. I would like to grant the user
    > the option to create their own filenames and the paths for the created
    > files.


    Careful with the terminology. "path" and "filename" are almost
    synonyms.

    Programs (in Unix) which hardcode the output paths do indeed suck.
    There are a few better design choices, assuming the program needs to
    generate more than one file:

    % foo # creates files in current directory
    % foo --src bar.c --hdr bar.h
    # the number of files is small and known
    % foo --dest /tmp/bar/
    # create /tmp/bar/ if needed and leave any files there
    % foo --prefix /tmp/bar
    # files are called bar.01, bar.02, ...

    And others. You don't say what the program does, and it's hard to guess.

    > My question is in which environment to tackle this: C or C++?


    C, of course. Why would you add an extra work load by porting it to
    C++? It's not as if C cannot write to files.

    Followup set.

    > I have not programmed for some time but keep up to date as best I can. I
    > have a limited experience in using OO languages but I do not want to devote
    > myself into becoming an expert in either language just getting to grips with
    > the bits that I need for this exercise.


    You don't need to learn OO for this.

    > I should add that this is a Linux exercise.


    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, May 16, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KavvY
    Replies:
    1
    Views:
    403
  2. Mr Gordonz

    Advice on design approach and principles

    Mr Gordonz, Aug 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    373
    Steve C. Orr, MCSD
    Aug 4, 2003
  3. =?Utf-8?B?TWFubnk=?=

    Advice on best approach

    =?Utf-8?B?TWFubnk=?=, Dec 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    368
    =?Utf-8?B?TWFubnk=?=
    Dec 23, 2004
  4. Mudcat
    Replies:
    9
    Views:
    432
    Dennis Lee Bieber
    Mar 21, 2006
  5. Pinnerite
    Replies:
    7
    Views:
    235
    Jorgen Grahn
    May 17, 2013
Loading...

Share This Page