How can I read a directory in a c program?

Answer Posted / banavathvishnu

int main(int argc,char *argv[])
{

printf("%s \n",argv[0]);
return 1;
}
will give you the path where the executable is stored.

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is #line used for?

608


How would you use the functions fseek(), freed(), fwrite() and ftell()?

705


Can we change the value of static variable in c?

562


What is pass by value in c?

596


Explain what is a 'locale'?

585






How can I prevent another program from modifying part of a file that I am modifying?

614


Why doesnt the call scanf work?

671


Give me the code of in-order recursive and non-recursive.

886


How can I automatically locate a programs configuration files in the same directory as the executable?

632


Why & is used in scanf in c?

625


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1118


How can I find out the size of a file, prior to reading it in?

622


How many types of operators are there in c?

615


What is c preprocessor mean?

793


What is pointer and structure in c?

574