Octet to char conversion

Hi,

I am trying to get a mean shift algorithm code to work. The code is written for a linux based environment and I am working with windows so I have to make a few changes to the code to make it work.

So there's this one problem that I cant solve. Its the conversion from Octet to char. The devc++ compiler gives the error that there's an invalid conversion from `Octet*' to `char*'. One particular function is given below in which the error occurs.

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
static RasterIpChannels* read_PPM_file( istream* fp )
{
  int	c1 = fp->get();
  int	c2 = fp->get();
  int	c3 = fp->get();

// test point
  
  if ( c1 == 'P' && c3 == '\n' )
    {
      Octet**	datain = new Octet*[p_max];
      int	w, h, m;

      switch ( c2 ) {
      case '3':
	{
	  skip( fp );
	  *fp >> w >> h;
	  int i;
	  for ( i = 0; i < p_max; i++ ) {
	    datain[i] = new Octet[w * h];
	  }
	  fp->get();
	  skip( fp );
	  *fp >> m;
          
          
	  for ( int j = 0, idx = 0; j < h; j++ ) {
	    for ( i = 0; i < w; i++, idx++ ) {
	      *fp >> c1 >> c2 >> c3;
	      datain[0][idx] = c1;
	      datain[1][idx] = c2;
	      datain[2][idx] = c3;
	    }
	  }
	}
	break;

      case '6':
	{
	  skip( fp );
	  *fp >> w >> h;

	  for ( int i = 0; i < p_max; i++ ) {
	    datain[i] = new Octet[w * h];
	  }
	  fp->get();
	  skip( fp );
	  *fp >> m;


	  fp->get();
	  skip( fp );
       
          cout << "Image Dim  h: " << h << "  w: " << w << endl;
          cout << "Max Value  m: " << m << endl;
          Octet *temp_buf = new Octet[h*w*3]; 
// ++++++++++++++++++++++++
	  fp->read(temp_buf, h*w*3); // error occurs over here!!
// ++++++++++++++++++++++++
          Octet *temp0 = datain[0];
	  Octet *temp1 = datain[1];
	  Octet *temp2 = datain[2];
	            
	  for ( register int j = 0, idx = 0; j < h*w; j++) {
	      temp0[j] = temp_buf[idx++];
	      temp1[j] = temp_buf[idx++];
	      temp2[j] = temp_buf[idx++];
	    }
          delete [] temp_buf;
	}
	break;

      default:
	cerr << "File is not the PPM format." << endl;
	return NULL;
      }

      XfRaster::Info	info;
      info.rows = h;
      info.columns = w;
      info.origin_x = 0;
      info.origin_y = 0;
      return (new RasterIpChannels( info, p_max, eDATA_OCTET,
				    datain, true ) );
    }
  cerr << "File is not the PPM format." << endl;
  return NULL;
}

The devc++ compiler gives the error that there's an invalid conversion from `Octet*' to `char*'.
Quite right. What is an Octet?
Topic archived. No new replies allowed.