FILE *fp;
fp= fopen("test.ini","r");
if(!fp)
{
fp = fopen("test.ini","w");
//fputs();
}
By default, we want to read the file. If the file does not exist, fopen will return NULL. At this time, we will use the write attribute to recreate the file.