<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 10, 2018 at 7:13 AM, David Cole via vtkusers <span dir="ltr"><<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Have you tried<br>
<br>
"reader->SetFileName(fileName.<wbr>toStdString().c_str());"<br>
<br>
?<br>
<div><div class="h5"><br></div></div></blockquote><div>If your filename may have international characters in it, you will want filename.toLocal8Bit().data() instead. But filename.toStdString().c_str() will work fine with only ASCII in the filename.</div><div><br></div><div>HTH,</div><div>Shawn<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
<br>
On Wed, Jan 10, 2018 at 4:33 AM, Abdelkhalek Bakkari<br>
<<a href="mailto:bakkari.abdelkhalek@hotmail.fr">bakkari.abdelkhalek@hotmail.<wbr>fr</a>> wrote:<br>
> Hi All,<br>
><br>
><br>
> I tried to read an STL file using vtkSTLReader from a directory as<br>
> follows:<br>
><br>
><br>
><br>
> -------------------------<br>
><br>
> QString fileName = QFileDialog::getOpenFileName( this, tr("Open File"),<br>
> "C:\\", tr("Mesh (*.stl *.vtk)"));<br>
> if (fileName.isNull()) //user cancelled<br>
> return EXIT_FAILURE;<br>
><br>
> m_imagePath = fileName;<br>
> //Create an STL reader for reading the file<br>
> vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>:<wbr>:New();<br>
> //reader->SetFileName(<wbr>pathName.c_str());<br>
> reader->SetFileName(fileName.<wbr>toStdString());<br>
> reader->Update();<br>
> -------------------------<br>
><br>
><br>
> But, I've got the following error :<br>
><br>
> 'vtkAbstractPolyDataReader::<wbr>SetFileName' : cannot convert parameter 1 from<br>
> 'std::string' to 'const char *'<br>
><br>
><br>
> Could you please propose a solution for this issue?<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/<wbr>listinfo/vtkusers</a><br>
><br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/<wbr>listinfo/vtkusers</a><br>
</blockquote></div><br></div></div>