Lines are missing

Hi everyone

I want to make decimal to binary (but 8 digit)
Translate 8 digit code,

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  void steganografi::decimaltobinary(){
    i = 0;
    ifstream openFile1 ("pixel.txt");
    string line1;
    int bin = 0,p = 1;
    int length = 0,fark=0,j=0;
    ofstream dosya;
    dosya.open("binary.txt");
    while (getline(openFile1, line1)) {
                bin = 0,p = 1;
                if (line1.empty()) continue;
                cout<<line1<<endl;
                istringstream iss(line1);
                int value;
                value = atoi(line1.c_str());
                    while(value > 0){
                      bin += (value%2)*p;
                      value = value/2;
                      p*=10;
                     }
                string stringbin;
                stringstream convert;
                 convert << bin;
                 stringbin = convert.str();
                 fark = 0;
                 length = stringbin.size();
                 fark = 8-length;

                 if(fark != 0){
                    for(j=0;j<fark;j++){
                        stringbin = string("0") + stringbin;

                    };
                    j = 0;
                 }
                    dosya << stringbin << endl;
                    cout<<stringbin<<endl;
                i++;
            }
            
}


Pixel.txt
1
2
3
4
5
6
7
8
9
10
11
145
133
73
82
26
15
23
61
12
...
...


problem

http://i.hizliresim.com/j2Y0ag.png

lines are missing
Topic archived. No new replies allowed.