.extention file

This is a discussion on .extention file within the C Programming forums, part of the General Programming Boards category; I am having problem in creating the automatic increament of file extention. My existing format is sprinf(MOutput1,"%s%03u.%3s",Outmask,Filenum,"D01" ) sprinf(MOutput2,"%s%03u.%3s",Outmask,Filenum,"D02" ) ...

  1. #1
    Unregistered
    Guest

    .extention file

    I am having problem in creating the automatic increament of file extention.

    My existing format is

    sprinf(MOutput1,"%s%03u.%3s",Outmask,Filenum,"D01" )
    sprinf(MOutput2,"%s%03u.%3s",Outmask,Filenum,"D02" )
    sprinf(SOutput1,"%s%03u.%3s",Outmask,Filenum,"D03" )
    sprinf(SOutput2,"%s%03u.%3s",Outmask,Filenum,"D04" )

    Here D01, D02 , D03,D04 is static but i want to make it dynamic.

    Tnx in advance

    Dev

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    So use an int, and increment it.

    Code:
    i = 1;
    sprintf(MOutput1,"%s%03u.D%02d",Outmask,Filenum,i) 
    i++;
    sprintf(MOutput1,"%s%03u.D%02d",Outmask,Filenum,i)
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 04:39 AM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10:54 AM
  3. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21