Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_DEPRECATE
- #include <iostream>
- using namespace std;
- int main()
- {
- FILE *fp;
- fp = fopen("c:\\myfiles\\sample2.txt", "a");
- if (!fp)
- {
- cout << "Cannot open file.\n";
- system("pause");
- exit(1);
- }
- //Prints and append character ASCII value from 65-90 (A-Z) to a file
- for (int i = 65; i<91; i++)
- fputc(i, fp);
- fputc('\n', fp);
- //Prints and append character ASCII value from 97-122 (a-z) to a file
- for (int i = 97; i<123; i++)
- fputc(i, fp);
- fputc('\n', fp);
- //Prints and append character ASCII value from 97-106(a-j) to a file
- for (int i = 97; i<107; i++)
- fputc(i, fp);
- fclose(fp);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement