Write multiple files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ingavatne
    New Member
    • Jul 2008
    • 1

    Write multiple files

    Hey!

    I am trying to write a c program that converts multiple files of one kind to similar files of anther kind. Do anyone have suggestions of how I can do this in a easy way and avoid writing
    Code:
    ..FILE *out;..
    for each file when each file will have names like out001, out002 etc. and the corresponding in files will be in001, in002 etc.Since it is quite a lot of files.
  • karthigeyantp
    New Member
    • Jul 2008
    • 22

    #2
    i couldn't get u. put me an example

    Comment

    • newb16
      Contributor
      • Jul 2008
      • 687

      #3
      Assuming you have no more than 1000 files
      Code:
      char filename[length];
      i=3;  //e.g.
      sprintf(filename,"out%03d",i); // 3 chars, zero padded
      and then use filename in fopen() as usual

      Comment

      Working...