TWRITE


/////T-WRITE BY H:STOLPE////*
/////This nifty program writes text at any position in a file /////////////////
///The data written overwrites any existing data at the current seek position/


#include <stdio.h>
#include <direct.h>
int main()
{
FILE *stream;
char *list;
int  numwritten,result,chresult;
list = "base in your face!";


////use chdir to set active path
	chresult=chdir("C:\\MVSCNT\\BIN");
//////////////////open file as read + write
   if( (stream = fopen( "autoexec.bak", "r+" )) != NULL )
  {
/////////////////set writing position
     result = fseek( stream, 2L, SEEK_SET);
     numwritten = fwrite( list, sizeof( char), 20, stream );
     printf( "Number of items written = %d\n", numwritten );
     fclose( stream );
  }
  else
     printf( "Was not able to open the file\n" );

getch();
return(0);
}