Problem using SEGMENT library

Hello everybody,

     I am having a small problem with GRASS programing. While creaing
      a segment file from a raster file using segment library I am having
      problems. As you all know, segment_put_row(seg, buf, row)
     requires buf to be of type char *. Now when we use G_get_map_row,
      to get a row of data how do you convert it to a character pointer?

     I succesfully could do it in ordinary C prog but I am getting problems
when I use it in GRASS. Eventhough at the time of writing the
segment file I make sure that char buffer is correct showing the values in the
row, but when I read a value from seg using segment_get(seg, val, row,col), I
am getting all junk in val.
Please let me know how to do it.
      Thankyou in advance.

Sudhakar

sudhakar@ecn.purdue.edu
  Purdue University