Thread: open files in a loop in C

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    4

    open files in a loop in C

    I have to open many small files in C. But the files are in the form a.001, a.002, .....a.00n.
    I lke to open files in a loop.
    like when int n = 1 open a.001
    upto n=n open a.00n.

    Can you please help me.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    sprintf the filename and the number together and then use it to call fopen.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    4
    thank you very much

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. loop the loop - feeling foolish
    By estos in forum C Programming
    Replies: 2
    Last Post: 04-07-2007, 02:45 AM
  2. Open GL header files
    By Rune Hunter in forum C++ Programming
    Replies: 1
    Last Post: 10-03-2005, 01:10 AM
  3. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  4. Dos commands hehe
    By Carp in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-17-2003, 02:51 PM
  5. Replies: 7
    Last Post: 10-15-2002, 10:55 PM