write a file:
#include<iostream>
using namespace std;
int main()
{
FILE *fp;
fp=fopen("e:\\myfiles\\sample.txt","w");
//Check permission if you can write a file
if(!fp)
{
cout << "cannot open file.\n";
system("pause");
exit(1);
}
//prints the character ASCII from 65 to 90 (A-Z) to a file
for(int i=65; i<91; i++)
fputc(i,fp);
fclose(fp);
return 0;
}
Guys can you explain this to me... I don't know how it works. but when i run it to my computer it works