<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GetFirstFile( ) not working for me. in LabWindows/CVI</title>
    <link>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296723#M19829</link>
    <description>&lt;DIV&gt;&lt;/DIV&gt;thank you, Mert&lt;BR /&gt;
&lt;BR /&gt;
such a simple solution, but one I would have never guessed on my own.&amp;nbsp; thanks!&lt;BR /&gt;
&lt;BR /&gt;
unfortunately i have since hosed my include paths for the
compiler. when i tried to track down this original problem using
the built in 'errno' variable, i somehow caused myself
some really ugly new problems.&lt;BR /&gt;
&lt;BR /&gt;
but ill leave discussion of my latest debacle to its separate thread.&amp;nbsp; &lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by rjohnson on &lt;SPAN class="date_text"&gt;12-06-2005&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;01:52 PM&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Dec 2005 19:50:38 GMT</pubDate>
    <dc:creator>rjohnson</dc:creator>
    <dc:date>2005-12-06T19:50:38Z</dc:date>
    <item>
      <title>GetFirstFile( ) not working for me.</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296259#M19801</link>
      <description>i can get GetDir() and SetDir() to work right, and GetFileSize()
returns correct value for appropriate file in the current directory&lt;BR /&gt;
&lt;BR /&gt;
but GetFirstFile() just returns a -1 error code (no files found) ... and the uninitialized garbage in the string.&amp;nbsp; &lt;BR /&gt;
&lt;BR /&gt;
what am i doing wrong?&lt;BR /&gt;
&lt;BR /&gt;
thanks&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; char directory[MAX_PATHNAME_LEN];&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;char filename[MAX_PATHNAME_LEN];&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;long errornumber, size;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;errornumber = GetDir(directory);&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("err: %i, %s\n",errornumber, directory);&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; errornumber=GetFirstFile (directory,1,0,0,0,0,0,filename);&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("err: %i, %s\n",errornumber,filename);&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;errornumber=GetFileSize("Error.c",&amp;amp;size);&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("err: %i, %i\n",errornumber,size);&lt;BR /&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Dec 2005 00:43:07 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296259#M19801</guid>
      <dc:creator>rjohnson</dc:creator>
      <dc:date>2005-12-06T00:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: GetFirstFile( ) not working for me.</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296272#M19803</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Actually, the first parameter to GetFirstFile cannot be just the path
of the directory you want to search.&amp;nbsp; The function looks for files
that &lt;I&gt;match &lt;/I&gt;the search path, so if you want to look for all
files directly under C:, you would pass "C:\*".&amp;nbsp; For all DLLs
directly under C:, pass "C:\*.dll", and so on.&amp;nbsp; To do this, make
the following change to your code:&lt;BR /&gt;
&lt;BR /&gt;
&lt;SPAN class="noindex"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; char directory[MAX_PATHNAME_LEN];&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;char filename[MAX_PATHNAME_LEN];&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;long errornumber, size;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;errornumber = GetDir(directory);&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("err: %i, %s\n",errornumber, directory);&lt;BR /&gt;
&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;B&gt; strcat(directory, "\\*");&lt;/B&gt;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; errornumber=GetFirstFile (directory,1,0,0,0,0,0,filename);&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("err: %i, %s\n",errornumber,filename);&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;errornumber=GetFileSize(&lt;B&gt;filename&lt;/B&gt;,&amp;amp;size);&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("err: %i, %i\n",errornumber,size);&lt;BR /&gt;
&lt;BR /&gt;
You should then be in business.&lt;BR /&gt;
&lt;BR /&gt;
Hope that helps.&lt;BR /&gt;
&lt;BR /&gt;
Mert A.&lt;BR /&gt;
National Instruments&lt;BR /&gt;
&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Dec 2005 01:22:04 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296272#M19803</guid>
      <dc:creator>Mert_A.</dc:creator>
      <dc:date>2005-12-06T01:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: GetFirstFile( ) not working for me.</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296723#M19829</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;thank you, Mert&lt;BR /&gt;
&lt;BR /&gt;
such a simple solution, but one I would have never guessed on my own.&amp;nbsp; thanks!&lt;BR /&gt;
&lt;BR /&gt;
unfortunately i have since hosed my include paths for the
compiler. when i tried to track down this original problem using
the built in 'errno' variable, i somehow caused myself
some really ugly new problems.&lt;BR /&gt;
&lt;BR /&gt;
but ill leave discussion of my latest debacle to its separate thread.&amp;nbsp; &lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by rjohnson on &lt;SPAN class="date_text"&gt;12-06-2005&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;01:52 PM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2005 19:50:38 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296723#M19829</guid>
      <dc:creator>rjohnson</dc:creator>
      <dc:date>2005-12-06T19:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: GetFirstFile( ) not working for me.</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296741#M19833</link>
      <description>never mind bout the compiler problem.&amp;nbsp; &lt;BR /&gt;
&lt;BR /&gt;
and your solution works perfectly.&amp;nbsp; thanks again!&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Dec 2005 20:39:25 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296741#M19833</guid>
      <dc:creator>rjohnson</dc:creator>
      <dc:date>2005-12-06T20:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: GetFirstFile( ) not working for me.</title>
      <link>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296744#M19834</link>
      <description>No problem.&amp;nbsp; Glad you figured out your include issues without too much pain.&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Dec 2005 20:41:03 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabWindows-CVI/GetFirstFile-not-working-for-me/m-p/296744#M19834</guid>
      <dc:creator>Mert_A.</dc:creator>
      <dc:date>2005-12-06T20:41:03Z</dc:date>
    </item>
  </channel>
</rss>

