int main(int argc, char **argv)
{
...
/*system中不支持使用格式符%s,%d等,因此使用sprintf()先使用格式符转换,再将转换后的字符串存放在buffer中*/
snprintf(buffer, sizeof(buffer), "cat '%s' | tr -d '\r''\n' > temp_logo.txt",argv[1]);
system(buffer);/*复制输入源文件到trmp_logo.txt*/
system("sed -i 's/0x//g' temp_logo.txt "); /*删除文件中的0x字符*/
system("sed -i 's/\ //g' temp_logo.txt ");/*删除文件中的空格*/
system("sed -i 's/\,//g' temp_logo.txt ");/*删除文件中的","*/
system("sed -i 's/\n//g' temp_logo.txt ");/*删除文件中的换行符*/
system("sed -i 's/\t//g' temp_logo.txt ");/*删除文件中的Tab键*/
...
}