You can open a file for writing with


FILE *OPTR;
OPTR = fopen( "filename.txt", "w" );


and write to it using