linux下文本的创建

int create_version_file(int version, char date)

{

FILE
ver = NULL;



ver = fopen(APP_VERSION_PATH, "w");

if (ver == NULL) {

DEBUG(LOG_ERR,"create file: %s failed\n", APP_VERSION_PATH);

return -1 ;

}



fprintf(ver, "%s_version=%d.%2d\n", APP_NAME, version/100, version%100);

fprintf(ver, "modified_date=%s\n", date);

fflush(ver);//update file data  rewrite

fclose(ver);



return 0;

}

sitemap