We can create a xml file using C language.It is possible to enter values into a xml file through program.We can use fprintf to write into a file.Here is the program for this:-
#include<stdio.h>
#include<conio.h>
#define numcomp 20
void main()
{
int i=0;
FILE* XMLFile = fopen("output.xml","wb");
fprintf(XMLFile,"<zones count=\"%d\">\n",numcomp);
for(i=1;i<=numcomp;i++)
{
fprintf(XMLFile,"<zone index=\"%d\">\n",i);
fprintf(XMLFile,"%s","</zone>\n");
}
fprintf(XMLFile,"</zones>\n",numcomp);
fclose(XMLFile);
printf("file is created");
_getch();
}
Output XML File :-
No comments:
Post a Comment