Hi,
is there anyone who could help me to writing my program output to txtfile. i mean read file and write the output to txtfile
for example:
FILE *fp

fp = fopen("test.txt", "r");
if(fp = NULL){
printf.......
}
and what should i do to writing the output to txtfile

thanks for help

The fopen() statement is the same, except with "w" open flag instead of "r"

use fprintf() to write text lines.

Hi Ancient Dragon,
do u mean like that? please could u give me an example

    FILE *MyFile, *outfile; 

/**
** @fopen check for file, open file 
*/

    MyFile = fopen( "test.txt", "r");
    if (MyFile == NULL)

    {
        printf ("\ncould not open the file\n");
        printf ("I have failed you...  I'm sorry.\n\n");
}

     else if((outfile = fopen("sample.txt", "w"))==NULL) 
    {
        fprintf(outfile," %s");
    }

do any one know the program of predicitive parsing in c?help me.with example

You're sort of on the right track. How about trying it out for yourself and see what happens rather than constantly asking for examples. And then post back if you still have issues - your learning experience will be far better this way.

Also, learn how to post code properly using code tags. Before posting any code in the future, read the material at this link:
http://www.daniweb.com/forums/thread93280.html

do any one know the program of predicitive parsing in c?help me.with example

I make no apologies for shouting:

STOP HI-JACKING THREADS!!!

Start a new thread and show some effort in formulating a question that is specific - unlike the vague crap you have posted.

You're sort of on the right track. How about trying it out for yourself and see what happens rather than constantly asking for examples. And then post back if you still have issues - your learning experience will be far better this way.

Also, learn how to post code properly using code tags. Before posting any code in the future, read the material at this link:
http://www.daniweb.com/forums/thread93280.html

@OP:
Please refrain from sending me PMs telling me that my advice is worthless. If you think that, then put it out here on the forum - I'm a big boy - I can take the heat. Just bear in mind that I'll probably choose to ignore any of your postings in the future.

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.