I have 300+ files and I am reading it via C program...i am able to compile but what should I pass while executing C program...below is my code...i am bit new to the C ...

int i;
FILE *in;
FILE *out;
char ifile[100],ofile[100];

main() {
   for (i = 0; i < 3; i++)
     {
     sprintf(ifile,"/shell/file%03d.dat",i);

    sprintf(ofile,"/shell/o_file%03d.dat",i);

    in = fopen("ifile","rb");

    out = fopen("ofile","wb");

    fclose(in);
    fclose(out);
    return(0);
      }
}

Before trying to understand what you need help with, I want to make a comment about the code itself. I will try to address your question - to the extent that you asked one at all - in a follow-up post, but I wanted to get this out of the way. Feel free to skip this if you don't care about writing good code.

This line shouldn't compile on any compiler that isn't older than I am guessing you are:

main() {

While the original K&R C allowed for default function return values, since the late 1980s the C standard has required a return type declaration. In the case of main() that type should always - always, regardless of what certain older compilers allowed - be int.

Some older compilers allowed default return types up to the late 1990s (usually with some sort of warning), in order to ease the updating of older code, but most newer compilers will reject this code. I am guessing that you are using Turbo C, however, in which case my advice is DON'T.

Aside from the fact that Turbo C is 30 years old, and does not support any of the changes to the language made since 1989, it also has the glaring fault in that it allows main() to be declared as type void. This was based on a misunderstanding of the proposed standard which was still being debated at the time Turbo C 1.0 came out, and later versions of the standard mostly closed the loophole in question.

The exception in question was that a compiler for an embedded system was allowed to use void main() if they didn't have an operating system to return a value to; it was only meant for code that would never be portable, for use only in specific circumstances. The compiler was allowed to do this, but doing so would make the programs 'non-compliant', meaning that other compilers were free to reject it.

Unfortunately, some compiler writers in the 1980s, including those at Borland, took this to mean that they could accept void main() anywhere and it would be all good, which wasn't the intent.

This , and several of the other flaws and brainfarts in the Borland compiler, led to a lot of bad, system-dependent programs which were tightly tied to MS-DOS. In a sensible world, this would have ended when newer, better compilers that followed later standards arose.

Unfortunately, several countries (most notably India and Pakistan) standardized on Turbo C and Turbo C++ relatively early on, and have stubbornly refused to budge for thirty years - despite the fact that, for more than ten of those years, they could not distribute the compiler legally (because it was no longer for sale, and the owners still held the copyright; eventually, they made it public domain, but that just made the problem worse).

The damage this has done to those countries' efforts to modernize is incalculable, and ought to be the subject of mass protests by the university students and stripping of tenure from those responsible - and possibly even criminal charges made against them.

OK, sorry for the rant, but this is a topic that keeps coming up in this group and elsewhere. It is simply unconscionable that the university standards groups in those nations are still forcing this dreck down their students' throats.

I have heard that this has eased up somewhat recently, with the rules for which compilers and languages can be used in university courses and qualification exams being relaxed, but I don't know if it is true or not. I still see too many bright, promising IT students being forced to use something that is actively harmful to their education and their career, something which will hold them back by several years when they graduate, and frankly, it is a terrible shame to see.

In 1988, Turbo C was a great forward step, but in 2018, it is as useful as a buggy whip.

Sorry about that... anyway, it isn't entirely clear what you are asking, here:

what should I pass while executing C program...below is my code

Could you elaborate on this, and maybe give us a bit more detail on what the program is meant to do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.