<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hello everyone:<div><br></div><div>I access data file with bellow method:</div><div> QString <span style="font-size: 10pt;">layname</span><span style="font-size: 10pt;">= "assets:/test.mif";</span></div><div>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QFile</span><span style=" color:#c0c0c0;"> </span>file(layname);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QDir</span><span style=" color:#c0c0c0;"> </span>dir;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>qDebug()<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"ABSfilepath = "</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>dir.absoluteFilePath(file.fileName());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(file.exists())</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>qDebug()<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"file exists."</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>qDebug()<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"open = "</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>file.open(QFile::ReadOnly);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>qDebug()<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"data = "</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>file.readAll();</pre><pre style="margin-top: 0px; margin-bottom: 0px;"> }</pre><pre style="margin-top: 0px; margin-bottom: 0px;">In this way, program prints "file exists".</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">but when I access this file with MITAB interface :</pre><pre style="margin-top: 0px; margin-bottom: 0px;"> handle<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>mitab_c_open(layname.toAscii().data());</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span>(handle!=<span style=" color:#000080;">0</span>)</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>qDebug()<<<span style=" color:#008000;">"open lay success"</span>;</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">else</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>qDebug()<<<span style=" color:#008000;">"open lay fail"</span>;</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>qDebug()<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"Error = "</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>mitab_c_getlasterrormsg();</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span>;</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre><pre style="margin-top: 0px; margin-bottom: 0px;">mitab_c_open() still return failed. when I access file like bellow:</pre><pre style="margin-top: 0px; margin-bottom: 0px;"> <span style="font-family: Tahoma; font-size: 10pt;">mitab_c_open("/data/tmp/test.mif")</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="font-family: Tahoma; font-size: 10pt;">it will return success.</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">I think this different is caused by file path, but I am not sure.</pre><pre style="margin-top: 0px; margin-bottom: 0px;">Does anyone has experience with this? Could you please give me a suggestion?</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre><pre style="margin-top: 0px; margin-bottom: 0px;">Thanks in advancd.</pre><pre style="margin-top: 0px; margin-bottom: 0px;">Eric</pre><pre style="margin-top: 0px; margin-bottom: 0px;">2013.2.4</pre></pre></div> </div></body>
</html>