<?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 IO::File::ReadBin and CopyBin returns FileNotFound error in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/IO-File-ReadBin-and-CopyBin-returns-FileNotFound-error/m-p/293263#M2725</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;I created a function that supposed to read a binary file.&lt;BR /&gt;&lt;BR /&gt;I was able to open (IO::File::Open) the file without error but when I read (IO::File::ReadBin) the file, it returns 0x81000100 (FileNotFound) and the "destination" is empty. When I copy (IO::File::CopyBin) it, it also returns the same error but the content was copied. &lt;STRONG&gt;EDIT:&lt;/STRONG&gt; Copied to "destination".&lt;BR /&gt;&lt;BR /&gt;Why it return this error?&lt;/DIV&gt;</description>
    <pubDate>Wed, 30 Nov 2022 09:44:28 GMT</pubDate>
    <dc:creator>ReignBough</dc:creator>
    <dc:date>2022-11-30T09:44:28Z</dc:date>
    <item>
      <title>IO::File::ReadBin and CopyBin returns FileNotFound error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/IO-File-ReadBin-and-CopyBin-returns-FileNotFound-error/m-p/293263#M2725</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;I created a function that supposed to read a binary file.&lt;BR /&gt;&lt;BR /&gt;I was able to open (IO::File::Open) the file without error but when I read (IO::File::ReadBin) the file, it returns 0x81000100 (FileNotFound) and the "destination" is empty. When I copy (IO::File::CopyBin) it, it also returns the same error but the content was copied. &lt;STRONG&gt;EDIT:&lt;/STRONG&gt; Copied to "destination".&lt;BR /&gt;&lt;BR /&gt;Why it return this error?&lt;/DIV&gt;</description>
      <pubDate>Wed, 30 Nov 2022 09:44:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/IO-File-ReadBin-and-CopyBin-returns-FileNotFound-error/m-p/293263#M2725</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2022-11-30T09:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: IO::File::ReadBin and CopyBin returns FileNotFound error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/IO-File-ReadBin-and-CopyBin-returns-FileNotFound-error/m-p/293264#M2726</link>
      <description>I've used this function in my code without problems. Could you post some code to show what you're doing?</description>
      <pubDate>Tue, 11 Feb 2020 11:21:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/IO-File-ReadBin-and-CopyBin-returns-FileNotFound-error/m-p/293264#M2726</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2020-02-11T11:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: IO::File::ReadBin and CopyBin returns FileNotFound error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/IO-File-ReadBin-and-CopyBin-returns-FileNotFound-error/m-p/293265#M2727</link>
      <description>//err = IO::fileSystem.GetSpecialLocation(IO::FileSystem::ApplicationFolder, &amp;amp;apxPath); // not APX location&lt;BR /&gt;
	LPSTR apxPath = new TCHAR[_MAX_PATH];&lt;BR /&gt;
	GetModuleFileName((HINSTANCE)&amp;amp;__ImageBase, apxPath, _MAX_PATH);&lt;BR /&gt;
	char* pos = str_lastchr(apxPath, '\\');&lt;BR /&gt;
	pos[1] = 0; // get only the location&lt;BR /&gt;
	&lt;BR /&gt;
	IO::Location binPath;&lt;BR /&gt;
	binPath.Set(apxPath);&lt;BR /&gt;
	IO::Name fname = IO::Name(/*input: filename without extension*/);&lt;BR /&gt;
	fname.Append(".bin"); // file extension&lt;BR /&gt;
	err = binPath.AppendToLocal(fname);&lt;BR /&gt;
	//binPath.PrintDebug();&lt;BR /&gt;
&lt;BR /&gt;
	// open file&lt;BR /&gt;
	IO::File srcFile(binPath);&lt;BR /&gt;
	err = srcFile.Open(IO::File::ReadMode); &lt;B&gt;&amp;lt;== no error here&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
	// get size&lt;BR /&gt;
	USize szStr = 0;&lt;BR /&gt;
	err = srcFile.GetDataLength(&amp;amp;szStr); &lt;B&gt;&amp;lt;== no error here, returns correct file size&lt;/B&gt;&lt;BR /&gt;
	++szStr;&lt;BR /&gt;
&lt;BR /&gt;
	// read file&lt;BR /&gt;
	char* srcStr = new char[szStr]();&lt;BR /&gt;
	//err = srcFile.ReadBin(srcStr, szStr); &lt;B&gt;&amp;lt;== returns 0x81000100 (FileNotFound), srcStr is empty&lt;/B&gt;&lt;BR /&gt;
	err = srcFile.CopyBin(srcStr, szStr); &lt;B&gt;&amp;lt;== returns 0x81000100 (FileNotFound), srcStr contains what I needed&lt;/B&gt;</description>
      <pubDate>Wed, 12 Feb 2020 02:05:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/IO-File-ReadBin-and-CopyBin-returns-FileNotFound-error/m-p/293265#M2727</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2020-02-12T02:05:52Z</dc:date>
    </item>
  </channel>
</rss>

