your request are so general. Please specify yr requirement to get a detail help.
Ancient Dragon commented: Thanks for taking the time to use code tags :) +34
your request are so general. Please specify yr requirement to get a detail help.
I suppose that you are using C language. Here is your function
#include <stdlib.h>
int RunSystemCmd(char *pfilename)
{
char buff[512] = {0};
if (pfilename == NULL) return -1;
sprintf(buff,"HandBrakeCLI -i /dev/hdc -o /root/%s -b 1024 -B 128 -R 48 -E faac -f mp4 -w 368 -l 208 -m", pfilename);
return system(buff);
}
I think you should change your code as following:
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
using namespace std;
main()
{
// char *filenames[] = {"file1","file2","file3",NULL};
int n;
char buf[256];
FILE *fp = NULL;
cout<<" enter number of input files :";
cin>>n;
for(int i =0;i < n;i++){
sprintf(buf,"file%d.dat",i+1);
fp = fopen ( buf,"w");
if (fp == NULL) break;
fprintf(fp,"Copy \"C:\\Program Files\\prog\\prog%d.IN\" prog.In\n",i+1);
fclose(fp);
}
}