|
Technical Interview Questions
Visual Basic Interview Question
ASP .NET Interview Questions
C++ Interview Questions
C
Interview Questions
.........More
Programming Source Codes
C/C++ Source Codes
C# Source Codes
.........More
Aptitude Interview Questions
C/C++ Aptitude Questions
C Aptitude Questions
.........More
Tutorials
C Tutorial
C++ Tutorial
.........More
Soft Skills
Communication Skills
Leadership Skills
.........More
|
|
C/C++ Source Codes
programme to show the
include files of a specified .cpp or .h file
//to show the include files of a specified .cpp or .h file...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
FILE *file;
char filename[_MAX_PATH];
void main()
{
re_open:
system("cls");
puts("Type in the name of the .cpp or .h file whose #include files are to be
read:");
gets(filename);
system("cls");
file = fopen(filename, "r");
if(!file)
{
printf("The file '%s' could not be opened.\n", filename);
system("pause");
goto re_open;
}
else
{
int icount = 0;
do
{
char line[256];
fgets(line, 256, file);
if(!strncmp(line, "#include", 8))
{
char *result;
result = strpbrk(line, "<\"");
result ++;
result[strlen(result) - 2] = ' ';
printf(result);
icount ++;
}
}while(!feof(file));
if(icount == 0)
{
puts("No #include files");
}
system("pause");
fclose(file);
goto re_open;
}
}
<<<----- Return to
C/C++ Source Code Questions Page.
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Object Oriented Interview
Questions for more Object Oriented Interview Questions with answers
Check
Data Structure
Interview Questions for more data structure interview questions with
answers
|