<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hi&nbsp; Clint,<br><br>yeah I've done that...but likely I lose the pointer.... <br>The code I wrote is part of a function member in my main class so.. ... I don't quite get why Vtk behaves like that. <br>May be I have to cast safely the QArrayByte...in a different way?<br><br>dunnow what to think about.<br><br>Giancarlo<br><br>&gt; From: clinton@elemtech.com<br>&gt; To: vtkusers@vtk.org<br>&gt; Subject: Re: [vtkusers] -&gt;Update()....what does that do?<br>&gt; Date: Wed, 3 Feb 2010 10:50:22 -0700<br>&gt; CC: ilferraresebono@hotmail.it; daviddoria+vtk@gmail.com<br>&gt; <br>&gt; <br>&gt; There is the common problem of the char* pointer becoming invalid when the <br>&gt; QByteArray goes out of scope.  But if you're not omitting anything from your <br>&gt; code snippet, I guess that's not your problem.  What about using a debugger <br>&gt; and checking data when it goes to SetFileName(data).<br>&gt; <br>&gt; Clint<br>&gt; <br>&gt; On Wednesday 03 February 2010 10:41:13 am Giancarlo Amati wrote:<br>&gt; &gt; Hi David,<br>&gt; &gt;<br>&gt; &gt; yes I opened the file with Paraview and it's all perfectly visualised.<br>&gt; &gt; I've printed 'data' and the path name is ok.<br>&gt; &gt;<br>&gt; &gt; what the compiler returns is this:<br>&gt; &gt; Unhandled exception at 0x775c1ffe in QTVTK_Diorama.exe: 0xC0000005: Access<br>&gt; &gt; violation reading location 0x5f5bc9f4.<br>&gt; &gt;<br>&gt; &gt; Many Thanks.<br>&gt; &gt; Giancarlo<br>&gt; &gt;<br>&gt; &gt; Date: Wed, 3 Feb 2010 11:43:40 -0500<br>&gt; &gt; From: daviddoria+vtk@gmail.com<br>&gt; &gt; CC: vtkusers@vtk.org<br>&gt; &gt; Subject: Re: [vtkusers] -&gt;Update()....what does that do?<br>&gt; &gt;<br>&gt; &gt; On Wed, Feb 3, 2010 at 11:33 AM, Giancarlo Amati<br>&gt; &gt; &lt;ilferraresebono@hotmail.it&gt; wrote:<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Hello VTK users,<br>&gt; &gt; this might be already posted but I can't find it in the repository. So, I<br>&gt; &gt; apologies for any duplicate.<br>&gt; &gt;<br>&gt; &gt; I have these statements:<br>&gt; &gt;<br>&gt; &gt; QByteArray temp = fn-&gt;toAscii();<br>&gt; &gt; char *data = temp.data();<br>&gt; &gt;<br>&gt; &gt;         vtkSmartPointer&lt;vtkPolyDataReader&gt; drs = <br>&gt; &gt; vtkSmartPointer&lt;vtkPolyDataReader&gt;::New(); drs-&gt;SetFileName(data);<br>&gt; &gt;          drs-&gt;Update();<br>&gt; &gt;         vtkPolyData *pd = drs-&gt;GetOutput();<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; where QByteArray is a QT array of byte then converted into a string and<br>&gt; &gt; passed as input to PolyDataReader. so basically it's the path of the file<br>&gt; &gt; .vtk (which is a polydata) I would like to load.<br>&gt; &gt;<br>&gt; &gt; but the problem is that when i get to<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; drs-&gt;Update();<br>&gt; &gt;<br>&gt; &gt; it all crashes saying that an Unhandled expection has been generated.<br>&gt; &gt;<br>&gt; &gt; I checked out around and apparently it's the standard way to read a vtk<br>&gt; &gt; file (the one I have is ASCII format).<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Any suggestion would be helpful..<br>&gt; &gt;<br>&gt; &gt; Kind Regards.<br>&gt; &gt; Giancarlo Amati<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; A couple of things -<br>&gt; &gt;<br>&gt; &gt; 1) try opening the file with Paraview. If it crashes, your file is bad.2)<br>&gt; &gt; did you print 'data' to make sure the file name is as you expect? Thanks,<br>&gt; &gt;<br>&gt; &gt; David<br>&gt; &gt; _________________________________________________________________<br>&gt; &gt; Personalizza la tua vita digitale, scarica i nuovi gadget!<br>&gt; &gt; http://www.pimpit.it/<br>&gt; <br>                                               <br /><hr />Troppe caselle di posta? <a href='http://www.windowslive.it/hotmail/GestisciAltriAccount.aspx' target='_new'>Gestiscile da Hotmail!</a></body>
</html>