<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[datei adtribute]]></title><description><![CDATA[<p>hi,</p>
<p>wie kann man von einer datei die adtribute änder um die datei zb zu ändern?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/158029/datei-adtribute</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 03:25:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/158029.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 31 Aug 2006 16:47:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to datei adtribute on Thu, 31 Aug 2006 16:47:04 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>wie kann man von einer datei die adtribute änder um die datei zb zu ändern?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1128601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128601</guid><dc:creator><![CDATA[Leider nix weiß]]></dc:creator><pubDate>Thu, 31 Aug 2006 16:47:04 GMT</pubDate></item><item><title><![CDATA[Reply to datei adtribute on Thu, 31 Aug 2006 16:57:10 GMT]]></title><description><![CDATA[<p>Benutz die Forumsuche, das hatten wir letztens!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1128608</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128608</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Thu, 31 Aug 2006 16:57:10 GMT</pubDate></item><item><title><![CDATA[Reply to datei adtribute on Thu, 31 Aug 2006 17:17:39 GMT]]></title><description><![CDATA[<p>hab ich gelsen aber ich cheack das irgetwie nich !! kann jemand mir liebeswürdiger weise ein bespiel code hier posten wo zb datei C:/z.txt zb auf schreibgestüzt gesetzt wird??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1128624</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128624</guid><dc:creator><![CDATA[Leider nix weiß]]></dc:creator><pubDate>Thu, 31 Aug 2006 17:17:39 GMT</pubDate></item><item><title><![CDATA[Reply to datei adtribute on Thu, 31 Aug 2006 17:23:03 GMT]]></title><description><![CDATA[<p>Sozusagen, jo:</p>
<p>An application can retrieve the file attributes by using the GetFileAttributes or GetFileAttributesEx function. The CreateFile and SetFileAttributes functions can set many of the attributes. However, applications cannot set all attributes.</p>
<p>The code example in this topic uses the CopyFile function to copy all text files (.txt) in the current directory to a new directory of read-only files named \TextRO. Files in the new directory are changed to read only, if necessary.</p>
<p>The application creates the \TextRO directory by using the CreateDirectory function.</p>
<p>The application searches the current directory for all text files by using the FindFirstFile and FindNextFile functions. Each text file is copied to the \TextRO directory. After a file is copied, the GetFileAttributes function determines whether or not a file is read only. If the file is not read only, the application changes directories to \TextRO and converts the copied file to read only by using the SetFileAttributes function.</p>
<p>After all text files in the current directory are copied, the application closes the search handle by using the FindClose function.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;

void main()
{
   WIN32_FIND_DATA FileData; 
   HANDLE hSearch; 
   DWORD dwAttrs;   
   TCHAR szDirPath[] = TEXT(&quot;c:\\TextRO\\&quot;); 
   TCHAR szNewPath[MAX_PATH];   

   BOOL fFinished = FALSE; 

// Create a new directory. 

   if (!CreateDirectory(szDirPath, NULL)) 
   { 
      printf(&quot;Could not create new directory.\n&quot;); 
      return;
   } 

// Start searching for text files in the current directory. 

   hSearch = FindFirstFile(TEXT(&quot;*.txt&quot;), &amp;FileData); 
   if (hSearch == INVALID_HANDLE_VALUE) 
   { 
      printf(&quot;No text files found.\n&quot;); 
      return;
   } 

// Copy each .TXT file to the new directory 
// and change it to read only, if not already. 

   while (!fFinished) 
   { 
      lstrcpy(szNewPath, szDirPath); 
      lstrcat(szNewPath, FileData.cFileName); 
      if (CopyFile(FileData.cFileName, szNewPath, FALSE))
      { 
         dwAttrs = GetFileAttributes(FileData.cFileName); 
         if (dwAttrs==INVALID_FILE_ATTRIBUTES) return; 

         if (!(dwAttrs &amp; FILE_ATTRIBUTE_READONLY)) 
         { 
            SetFileAttributes(szNewPath, 
                dwAttrs | FILE_ATTRIBUTE_READONLY); 
         } 
      } 
      else 
      { 
         printf(&quot;Could not copy file.\n&quot;); 
         return;
      } 

      if (!FindNextFile(hSearch, &amp;FileData)) 
      {
         if (GetLastError() == ERROR_NO_MORE_FILES) 
         { 
            printf(&quot;Copied all text files.\n&quot;); 
            fFinished = TRUE; 
         } 
         else 
         { 
            printf(&quot;Could not find next file.\n&quot;); 
            return;
         } 
      }
   } 

// Close the search handle. 

   FindClose(hSearch);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1128625</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1128625</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Thu, 31 Aug 2006 17:23:03 GMT</pubDate></item><item><title><![CDATA[Reply to datei adtribute on Fri, 01 Sep 2006 13:10:20 GMT]]></title><description><![CDATA[<p>fatal error C1083: Datei (Include) kann nicht geöffnet werden: &quot;windows.h&quot;: No such file or directory was soll ich machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129107</guid><dc:creator><![CDATA[nix wissen]]></dc:creator><pubDate>Fri, 01 Sep 2006 13:10:20 GMT</pubDate></item><item><title><![CDATA[Reply to datei adtribute on Fri, 01 Sep 2006 13:21:42 GMT]]></title><description><![CDATA[<p>Was für eine IDE??? VC 2005 Express? Dann musst Du noch das PSDK installieren:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-143003.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-143003.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129130</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Fri, 01 Sep 2006 13:21:42 GMT</pubDate></item><item><title><![CDATA[Reply to datei adtribute on Fri, 01 Sep 2006 17:52:33 GMT]]></title><description><![CDATA[<pre><code>error C2664: 'SetFileAttributesW': Konvertierung des Parameters 1 von 'const char [12]' in 'LPCWSTR' nicht möglich
        Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.
</code></pre>
<p>sag der jetz immer !!! was mach ich falsch?</p>
<p>hier der code:</p>
<p>#include &lt;windows.h&gt;</p>
<p>int main()<br />
{<br />
SetFileAttributes(&quot;c:\\test.txt&quot;,FILE_ATTRIBUTE_SYSTEM);<br />
return 0;<br />
}[/code]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129313</guid><dc:creator><![CDATA[nix wissen]]></dc:creator><pubDate>Fri, 01 Sep 2006 17:52:33 GMT</pubDate></item><item><title><![CDATA[Reply to datei adtribute on Fri, 01 Sep 2006 18:14:51 GMT]]></title><description><![CDATA[<p>Oh...das sind Grundlagen...der meckert wg. UNICODE...so müsste es gehen:</p>
<pre><code class="language-cpp">#include &lt;Windows.h&gt;

int main()
{
    SetFileAttributes(TEXT(&quot;C:\\test.txt&quot;), FILE_ATTRIBUTE_SYSTEM);
    return (0)
}
</code></pre>
<p>EDIT: Denn: VC2005 Express Ed. kompiliert nach Voreinstellung autom. auf UNICODE.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129320</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129320</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Fri, 01 Sep 2006 18:14:51 GMT</pubDate></item></channel></rss>