mrg_ui/src/mtktextbuffer.cxx
//============================================================================
// Store the text from here into the named file.
//
Store the text from here into the named file.
Store the text from here into the named file .
void textBuffer::SaveText(char *fname)
{
	if (framework.Tcl("%s get 1.0 end", tk_name.str()) != TCL_OK) {
		return;
	}
	char *ptr = framework.interp->result;
	if(ptr == NULL){
		return;
	}
	int size = strlen(ptr);
	if (size > 0) { 	
		--size;		
	}
	FILE *fl = fopen(fname, "w");
	if(fl == NULL){
		return;
	}
	fwrite(ptr, 1, size, fl);
	fclose(fl);
	return;
}
void textBuffer :: SaveText ( char * fname ) { if ( framework . Tcl ( " " , tk_name . str ( ) ) != TCL_OK ) { return ; } char * ptr = framework . interp -> result ; if ( ptr == NULL ) { return ; } int size = strlen ( ptr ) ; if ( size > 0 ) { -- size ; } FILE * fl = fopen ( fname , " " ) ; if ( fl == NULL ) { return ; } fwrite ( ptr , 1 , size , fl ) ; fclose ( fl ) ; return ; }
Store the text from here into the named file.
Store the text from here into the named file .
// could be Assert(size): TK is reliably bad. // Bug 20121: TK text widget adds CR(s) to end text!