osx - Converting to const in C++ -


c++, os x, carbon api.

i need pass in const fsspec method fspopendf

i have follows:

const fsspec fsspec = ffilespec.getfsspec();/* declared fsspec getfsspec() const; */  err = ::fspopendf(fsspec, 1, &refnumber); 

but error is:

error: cannot convert 'const fsspec' 'const fsspec*' argument '1' 'oserr fspopendf(const fsspec*, sint8, short int*)' 

i have tried defining as:

const fsspec*  fsspec = ffilespec.getfsspec();   

and doesn't help. confused.

can explain concept missing?

try this:

fsspec fsspec = ffilespec.getfsspec(); err = ::fspopendf(&fsspec, 1, &refnumber); 

you seem understand need take address of object when calling function wanting pointer, refnumber; same merely needs done fsspec object since const fsspec* expected.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -