how to pass a file to a c program

Discussion in 'C Programming' started by Morris Dovey, Feb 16, 2008.

  1. Morris Dovey

    Morris Dovey Guest

    wrote:
    >
    > How to pass a text file to a c program ???
    >
    > Is it using abstract data types?? (eg. using arg v,arg
    > c)..........................???


    What have you tried? May we see your code?

    --
    Morris Dovey
    DeSoto Solar
    DeSoto, Iowa USA
    http://www.iedu.com/DeSoto
     
    Morris Dovey, Feb 16, 2008
    #1
    1. Advertising

  2. Morris Dovey

    Guest

    How to pass a text file to a c program ???

    Is it using abstract data types?? (eg. using arg v,arg
    c)..........................???
     
    , Feb 16, 2008
    #2
    1. Advertising

  3. Morris Dovey

    Army1987 Guest

    neha_chhatre wrote:

    > How to pass a text file to a c program ???

    What do you mean? If you mean that the program's stdin must be that file,
    how to do it is implementation specific, but with both *nix and MS
    DOS/Windows it is something like
    program < file.txt

    > Is it using abstract data types?? (eg. using arg v,arg
    > c)..........................???

    argv and argc are the traditional names of main()'s parameters.
    Look them up.
    You can do things such as
    if (argc >= 2)
    in = fopen(argv[1], "r");
    This has nothing to do with abstract data types.


    --
    Army1987 (Replace "NOSPAM" with "email")
     
    Army1987, Feb 16, 2008
    #3
    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. Jerry
    Replies:
    20
    Views:
    7,988
    Roedy Green
    Sep 9, 2005
  2. blufox
    Replies:
    2
    Views:
    575
  3. Mr A
    Replies:
    111
    Views:
    2,148
  4. Radde
    Replies:
    38
    Views:
    1,014
  5. how to pass a file to a c program

    , Feb 16, 2008, in forum: C Programming
    Replies:
    17
    Views:
    1,415
    William Pursell
    Feb 21, 2008
Loading...

Share This Page