Replacing a word of a text file, in C++ fstream

How to replace a word in text file using c++ fstream. Is there a way, without creating any temporary file. Could you please share pseudo code ???

If you can't use a temp file, this is how you must do it:

read_entire_file_into_memory();
replace_text();
write_modified_text_back_overwriting_file();