Re: [Vala] [Genie] array slices



This is the method I'm trying to modify:

    def inline send (output : array of char)
      sent : size_t
      if self.buff.str.length == 0     // write buffer is empty
        self.chan.write_chars(output, out sent)
        self.chan.flush()
        if output.length != sent       // buffer what we couldn't send
          self.buff.append_len(output) // !!! need to shift this to sent
          self.chan.add_watch(IOCondition.OUT, self.write)
      else
        self.buff.append_len(output)

It appears that I want to transfer ownership of "output" and make output a
pointer.  Is there a way to do that?


On Sat, May 22, 2010 at 2:41 PM, Abderrahim Kitouni <a kitouni gmail com>wrote:

A workaround: use pointers ;-) Yes, pointers should not be used too
often but they let you do (almost) anything C can do.
If you cast your array to char* you should be able to use the C syntax.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]