// ex1.c : Defines the entry point for the console application. // #include #include #include int FileSuccess(FILE * handle,const char * reason, const char * path) { OutputDebugString( reason ); OutputDebugString( path ); OutputDebugString(" Result : "); if (handle==0) { OutputDebugString("Failed"); return 0; } else { OutputDebugString("Suceeded"); return 1; } } int main(int argc, char * argv[]) { const char * filename="test.txt"; const char * mytext="Once upon a time there were three bears."; int byteswritten=0; FILE * ft= fopen(filename, "wb"); if (FileSuccess(ft,"Opening File: ", filename)) { fwrite(mytext,sizeof(char),strlen(mytext), ft); fclose( ft ); } printf("len of mytext = %i ",strlen(mytext)); return 0; }