convert const fmx::Text to c string?

Hello,

I'm trying to write a FileMaker plug-in function.

In this function I create a "const fmx::Text" which is the text from FileMaker (in this case a file path I want to verify exists), but I need to, I believe, convert it somehow to a regular c String so I can do something like this (to check for File Exists:

// needs to accept "/" in path name
std::fstream finout(path) ;
if (! (finout) )
{
// false
}
else
{
// true
}

---

However, my code to date isn't quite right for this conversion:

const fmx::Text &path = dataVect.AtAsText(0);

char *c_string;
c_string = new char[path.GetSize()];

for (int index = 0; index < path.GetSize(); index++){
c_string[index] = path[index] ;

I get an error that type const fmx::Text does not have a subscript operator.

Have tried multiple permutations of this (confused why it's so difficult, etc.), but have not yet been able to do this simple conversion.

Hopefully, the solution would allow a file path with "/" as part of the string.

----

Would appreciate any suggestions.

- M
Excellent. It works now!

Thanks much. :)

- m
Topic archived. No new replies allowed.