hey there,thanks for everyone that helped me till now, even though i was not registered :P
i have a problem with making pFile stops
im putting the sentences but i dont know how to stop it, the file should be called "q3.txt".
and i need to writie "finish" to stop putting sentences
while (sentence!=finish)
This compares the address of the sentence array with the (uninitialized) pointer finish. Unless you execute finish = sentence somewhere, they won't be equal.
while (sentence != "finish")
This compares the address of the sentence array with the array of the constant string "finish". They will never be equal.
What you want to do is compare the contents of the sentence array, not the address. For that you need strcmp: while (strcmp(sentence, "finish") != 0)
strcmp returns a value less than, equal to, or greater than 0 depending on whether the first argument is, respectively, lexographically less than, equal to, or greater than the second argument.
Since strcmp() 0 when strings are equal and this is contrary to the usual "0 is false) meaning, I always code it with an explicit comparison to zero. To me, this makes the code easier to read.