#include <stdio.h>
int main ()
{
FILE * fp;
char sentence []="Hello world";
char *fileName="mylog.txt";
char command[100];
fp = fopen (fileName,"a");
if(fp==NULL){
printf("File cannot be open for writing %s", fileName);
system("pause");
return 1;
}
//write to file
fputs (sentence,fp);
printf("Finish writing to a file\n");
fclose (fp);
//attrib +h will hide the file
sprintf(command,"attrib +h %s",fileName);
printf(command);
printf("\n");
system(command);
system("pause");
return 0;
}
int main ()
{
FILE * fp;
char sentence []="Hello world";
char *fileName="mylog.txt";
char command[100];
fp = fopen (fileName,"a");
if(fp==NULL){
printf("File cannot be open for writing %s", fileName);
system("pause");
return 1;
}
//write to file
fputs (sentence,fp);
printf("Finish writing to a file\n");
fclose (fp);
//attrib +h will hide the file
sprintf(command,"attrib +h %s",fileName);
printf(command);
printf("\n");
system(command);
system("pause");
return 0;
}