/* Copyright (c) 1984-98 by The MathWorks, Inc. */
/* $Revision: 1.2 $ */
/* 
 *	wrtprofl.c 
 * 
 *	Write a Windows private profile string 
 */ 
#include <windows.h> 
#include "mex.h" 
 
void mexFunction(nlhs,plhs,nrhs,prhs) 
int nlhs, nrhs; 
mxArray *plhs[], *prhs[]; 
{ 
	mxArray *pmat; 
	char	szIniFile[256],szSection[256],szEntry[256],szKey[256]; 
    BOOL bResult = FALSE;
 
	if (nrhs == 4 && nlhs == 1) 
	{ 
		mxGetString	(prhs[0], szSection, 255L); 
		mxGetString	(prhs[1], szKey, 255L); 
		mxGetString	(prhs[2], szEntry, 255L); 
		mxGetString	(prhs[3], szIniFile, 255L); 
 
		bResult = WritePrivateProfileString(szSection, szKey, szEntry, szIniFile); 
 		pmat = mxCreateDoubleMatrix( 1, 1, mxREAL);
        *(mxGetPr(pmat)) = (double)bResult;
	
    	plhs[0] = pmat; 
	} 
	else 
		mexErrMsgTxt("wrttprofl requires 4 inputs and 1 output."); 
} 
