Program to open a file with First argument



Program to open a file with First argument..

Answer / kishore kumar naik p

void main(int nArgCount, char *szArgVector[])
{
if(nArgCount != 2)
{
printf("\nWorng number of argument\nSynatx: %s
<filename>",szArgVector[0]);
return;
}

FILE *fp = foepn(szArgVector[1],"r+");
//Process the file here
fclose(fp);
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

A file pointer always contains the __________ of the file

5 Answers  


What is polymorphism in oops?

1 Answers  


What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?

1 Answers  


What is methods in oop?

0 Answers  


what is ltti

1 Answers   Unisys,


can we create and enter the data & hide files using programmes ?

2 Answers   Wipro,


What is encapsulation process?

0 Answers  


what is costructor?

1 Answers  


Difference between realloc() and free?

9 Answers   HP,


What is a scope resolution operator?

5 Answers   HP, IBS,


In the following declaration of main, "int main(int argc, char *argv[])", to what does argv[0] usually correspond? 1) The first argument passed into the program 2) The program name 3) You can't define main like that

6 Answers  


How can you overcome the diamond problem in inheritance?

0 Answers   NIIT,


Categories