I've got problem regarding output/input from files. Here is my program:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    FILE * out;
    out=fopen("tmp.txt", "w");
    for(int i=0; i<256; i++)
    {
        fprintf(out, "%c", char(i));
    }
    fclose(out);
    FILE * in;
    in=fopen("tmp.txt", "r");
    while(!feof(in))
    {
        char a=fgetc(in);
        cout<<int(a)<<endl;
    }
    fclose(in);
}
and here is the output:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-1
Why is it stopping so quickly?
Does that mean char(26) is EOF?
How could i write to file (of any type) to overcome this problem?
What I'm looking for is a way to freely write values (of any range, can be char, int or sth else) to a file and then reading it.
 
     
    