Re: Calling C function with file handles

new topic     » goto parent     » topic index » view thread      » older message » newer message

This might not be the best solution, but here goes:


Create an additional dll wich has 2 functions, openfile() and closefile():

  FILE *openfile(char *fname)
  {
    return fopen(fname);
  }

.you get the idea.

Use these functions in your euphoria program to get a correct file pointer, 
e.g.:

  constant openfile =
    define_c_func(my_dll, "openfile", {C_POINTER}, C_INT)
  -- define closefile() here

  constant fname = allocate_string("mumbo.jumbo")

  atom filePointer
  filePointer = c_func(openfile, {fname})

  -- do your stuff..

  c_proc(closefile, {filePointer})

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu