how to open file using c program?

freopen() OR fopen(). try to read about them, you will find them useful. thanks.

#include<stdio.h>
int main()
{
FILE *fp;
fp=fopen("c:\\1.txt","r+");
return 0;
}

its not working..plz help..

How can you tell that program isn't working since it doesn't actually have any output?

In order to know if it worked or not you have to test the return value of fopen()

#include<stdio.h>
int main()
{
FILE *fp;
fp=fopen("c:\\1.txt","r+");
if( fp == NULL)
   printf("file not found\n");
else
   printf("Success!\n");
fclose(fp);   
return 0;
}

using this code its only print success..
i want to display file in notepad..

using this code its only print success..

That's the point of the program, to tell you whether the file was opened successfully.

i want to display file in notepad..

Please note that we're not going to write your program for you. You asked a specific question and got a specific answer. Now it's up to you to ask more specific questions or apply what you've learned in this thread to your actual program.

You asked the wrong question at the beginning of this thread. Why didn't you say that in the first place, we can't read your mind. You need to use this function to launch Notepad.exe