Hello every one?I have a program use to copy the contents of an array to a File.But it does not work. when it runs Visual Studio starts to debug. But nothing happening.File contents does not change.Please help me tho solve this problem.Thank you very much.
Here is the program.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
FILE *f;
int i=0;
int data[]={1,2,3,4,5};
if((f=fopen("D:\data\def.txt","w"))==NULL){
printf("File can't open.\n");
}
else{
for(i=0;i<5;i++){
fprintf(f,"%s\n",data[i]);
}
}
}