>after doing this:
>
>$fw = fopen($file,"w");
>fwrite ($fw,$write,200);
>
>Im close to say:
>
>fwrite() and fputs() create both new files
>but dont insert data in a existing one.
Hmm, no. Neither fwrite() nor fputs() create new files. Files can be
created using the fopen() functions in write mode. fwrite() and fputs()
only write data into a file that was previous created or opened with fopen().
>Sure there is a way to work around, eg.
>reading the whole file and write it back,
>but there is no command which inserts variables
>into a file.
Ok, now I lost you a bit, but I think I get your drift now. You want to
append new data to a file, rather than recreate it from scratch. Depending
on what exactly you want to do, it may be possible.
If you want to append data at the end of the file, you can do it by opening
the file in append mode (modes "a" and "a+"). Appending data at the
beginning or middle of a file isn't possible using standard file IO
functions. For this, you have to create a new file with the new data, and
copy the data from the old file.