f



How do I create a mex file from my C File?

I have this program and I need to make it a mex in matlab, how do you
do it?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int main(int argc, char *argv[])
{
char text [100];
//Declare a File Pointer
FILE *file_ptr;
//Open the log file
file_ptr=fopen("BlackHostLog.txt", "r");
//Test
if(file_ptr != NULL)
{
printf("BlackHostLog.txt opened.\nContents:\n");
//Read the text
int passed=0;
while(fgets(text, 100, file_ptr)!=NULL && !passed)
{
printf("%s", text);
passed=strstr(text, "Sending Boot Event");
}
//Create the Status File
fclose(file_ptr);
file_ptr=fopen("status.txt","w");
if(file_ptr!=NULL)
{
printf("Status File Was Created\n");
if(passed)
{
fprintf(file_ptr, "passed\n");
}
else
{
fprintf(file_ptr, "failed\n");
}
fclose(file_ptr);
}
else
{
printf("Unable to create the status file.\n");
return 1;
}
system("PAUSE");
return 0;
}
}
0
12/18/2006 10:25:33 PM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
748 Views

Similar Articles

[PageSpeed] 53

Reply: