need advice2

This is a discussion on need advice2 within the C++ Programming forums, part of the General Programming Boards category; hello again.
1. My program below can read one line only from my open file px.txt
how to loop it. ...

need advice2

hello again.
1. My program below can read one line only from my open file px.txt
how to loop it. i need to use while loop command.
2. what happen with this command: if ((line[100] == line2[100]))
it must say " hello success" but output is "oooo"

I'm not as familiar with this C style coding, but if you never print "hello success", it's because line[100] never equals line2[100].
Unless this style of coding is different than what I'm used to, you should never have a line[100] or a line2[100]. You declare the lines to have 100 elements each near the beginning of your program. That's fine, but those elements are numbered from 0 - 99, i.e., line[0] through line[99].
In your if statement, you're trying to access the element line[100] and line2[100]. These elements are outside the bounds of your array, which ends at line[99] and line2[99]. A drawback of C and C++ is that the compiler lets you do this. The problem is that who knows what is in memory at spot line[100]? It could be anything.
If you're trying to compare the whole line, you don't need the brackets at all.

This is C, you might get more responses by posting it in the C board, not the C++ board. Okay, I'll go through the problems then post my version.

>void main ( void )
void main is wrong, the main function returns an int and nothing else.

>FILE *stream;
>FILE *stream2;
One problem, these names are hidious. What does stream do? What does stream2 do? Make your names more descriptive.

>char line[100];
>char line2[100]="!!Begin";
Same problem with the names, but not quite so bad in this case since line is a common name for a line of textual data. The biggest problem is the waste of space for line2, you alocate 100 elements yet only use 8 of them. This would be better as a string literal.

>stream2=fopen("pxo.txt","w");
You don't test to see if this worked anywhere.

>if( fgets( line, 100, stream ) ==NULL)
Your formattng is terrible, but it only effects the readability of the program. The problem here is that the size you pass to fgets is bound too closely to the size of line, if you change the number of elements that line has then you have to change this too. A better way is to use the sizeof operator on line.

>if ((line[100] == line2[100]))
This is the biggest problem. Since you didn't initialize the 99th element of either line or line2, the test will almost surely fail. If you want to test both strings in their entirety, use strcmp in string.h.