<?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[Brauche Hilfe bei Projekt]]></title><description><![CDATA[<p>Nabend,<br />
wir haben in unserer Klasse eine Aufgabe über die Ferien aufbekommen, wir müssen ein Verzeichnis in dem eine beliebe Anzahl von .txt Dateien sind öffnen, alle .txt Dateien auslesen und am Ende die Anschlagszahl (von der ich schon den quellcode hab wie man von einer Einzelnen Datei die Anschlagszahl ausließt) alle .txt Dateien in eine .txt Datei reinschreiben.<br />
Nur das Problem ist das wir das auslesen eines Verzeichnises noch nicht in der Schule gelernt haben und das ich jetzt schon zimlich lange dranhäng und einfach nicht weiterkomm.<br />
Ich hoffe das ihr mir helfen könnt.</p>
<p>MfG<br />
pc-master</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/144775/brauche-hilfe-bei-projekt</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 13:16:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/144775.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Apr 2006 15:15:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Brauche Hilfe bei Projekt on Fri, 21 Apr 2006 15:15:43 GMT]]></title><description><![CDATA[<p>Nabend,<br />
wir haben in unserer Klasse eine Aufgabe über die Ferien aufbekommen, wir müssen ein Verzeichnis in dem eine beliebe Anzahl von .txt Dateien sind öffnen, alle .txt Dateien auslesen und am Ende die Anschlagszahl (von der ich schon den quellcode hab wie man von einer Einzelnen Datei die Anschlagszahl ausließt) alle .txt Dateien in eine .txt Datei reinschreiben.<br />
Nur das Problem ist das wir das auslesen eines Verzeichnises noch nicht in der Schule gelernt haben und das ich jetzt schon zimlich lange dranhäng und einfach nicht weiterkomm.<br />
Ich hoffe das ihr mir helfen könnt.</p>
<p>MfG<br />
pc-master</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1042049</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1042049</guid><dc:creator><![CDATA[pc-master]]></dc:creator><pubDate>Fri, 21 Apr 2006 15:15:43 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Projekt on Fri, 21 Apr 2006 15:26:22 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>welches OS benutzt du?<br />
Falls Windows: <a href="http://www.mpdvc.de/html.htm#Q12" rel="nofollow">http://www.mpdvc.de/html.htm#Q12</a><br />
Falls Linux: <a href="http://www.galileo-press.de/openbook/c_von_a_bis_z/c_019_002.htm" rel="nofollow">http://www.galileo-press.de/openbook/c_von_a_bis_z/c_019_002.htm</a></p>
<p>Wenn du's platformunabhängig brauchst, nimm boost::filesystem : <a href="http://www.boost.org/libs/filesystem/doc/index.htm" rel="nofollow">http://www.boost.org/libs/filesystem/doc/index.htm</a></p>
<p>MfG</p>
<p>GPC</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1042062</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1042062</guid><dc:creator><![CDATA[GPC]]></dc:creator><pubDate>Fri, 21 Apr 2006 15:26:22 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Projekt on Sun, 23 Apr 2006 21:00:38 GMT]]></title><description><![CDATA[<p>Vielen Dank für die Hilfe</p>
<p>Ich habe mir des ma angeschaut und auhc versucht nur allerdings komm ich nicht weiter.</p>
<p>Könntet ihr mir des genauer erkären bzw. einen Beispielscode zeigen?</p>
<p>MFG pc-master</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1043665</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1043665</guid><dc:creator><![CDATA[pc-master]]></dc:creator><pubDate>Sun, 23 Apr 2006 21:00:38 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Projekt on Mon, 24 Apr 2006 05:03:50 GMT]]></title><description><![CDATA[<p>pc-master schrieb:</p>
<blockquote>
<p>Vielen Dank für die Hilfe</p>
</blockquote>
<p>Leider hast du immer noch nicht gesagt, welches OS du benutzt.</p>
<blockquote>
<p>Ich habe mir des ma angeschaut und auhc versucht nur allerdings komm ich nicht weiter.</p>
</blockquote>
<p>Geht's auch ein wenig genauer als &quot;ich komm nicht weiter&quot;? Sicher, dass du nicht nur jemanden suchst, der deine Arbeit macht?</p>
<blockquote>
<p>Könntet ihr mir des genauer erkären bzw. einen Beispielscode zeigen?</p>
</blockquote>
<p>Auf den Seiten, deren Links GPC gepostet hast, sind doch Beispiele, oder? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1043719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1043719</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 24 Apr 2006 05:03:50 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Projekt on Mon, 24 Apr 2006 09:30:57 GMT]]></title><description><![CDATA[<p>moin,</p>
<p>ja ich arbeite unter windows.</p>
<p>Die beiden Beispiele für Windows lassen sich nicht compilieren im Borland, weil immer FEhler kommen.</p>
<p>MFG pc-master</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1043818</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1043818</guid><dc:creator><![CDATA[pc-master]]></dc:creator><pubDate>Mon, 24 Apr 2006 09:30:57 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Projekt on Mon, 24 Apr 2006 09:33:02 GMT]]></title><description><![CDATA[<p>pc-master schrieb:</p>
<blockquote>
<p>Die beiden Beispiele für Windows lassen sich nicht compilieren im Borland, weil immer FEhler kommen.</p>
</blockquote>
<p>Und du möchtest jetzt was von uns hören... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1043824</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1043824</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Mon, 24 Apr 2006 09:33:02 GMT</pubDate></item><item><title><![CDATA[Reply to Brauche Hilfe bei Projekt on Tue, 02 May 2006 15:38:55 GMT]]></title><description><![CDATA[<p>Hier eigene Beispielimplementierung die unter debian und windoof funzen. Die Schnittstelle entspricht weitgehend der File Klasse in Java. Einige Methoden sind noch zu implementieren, bzw zu verbessern. Falls jemand bock hat, kann er ja was dazu sagen.</p>
<p>Header sio.h</p>
<pre><code class="language-cpp">#ifndef CFILE_H_
#define CFILE_H_

#if defined(__unix__)
	#include &lt;dirent.h&gt;
	#include &lt;unistd.h&gt;

	#define MODUS 0711

	#define EXISTS 	F_OK
	#define EXEC	X_OK
	#define WRITE	W_OK
	#define READ	R_OK

#elif defined(WIN32)
	#include &lt;direct.h&gt;
	#include &lt;windows.h&gt;
	#include &lt;io.h&gt;

	#define EXISTS  S_IREAD
	#define EXEC	S_IEXEC
	#define WRITE	S_IWRITE
	#define READ	S_IREAD

#endif

#include &lt;sys/stat.h&gt;
#include &lt;string&gt;
#include &lt;vector&gt;

class CFile {
private:
	std::string m_strFileName;
	std::string m_strParentFileName;

public:

	CFile(std::string strFileName, std::string strParentFileName = &quot;&quot;);
	CFile(const CFile&amp; rclFile);
	~CFile();

	CFile&amp; operator=(const CFile&amp; rclFile);

	bool operator==(const CFile&amp; rclFile) const;
	bool operator!=(const CFile&amp; rclFile) const;

	bool IsFile() const;
	bool IsDirectory() const;
	bool IsHidden() const;

	long lastModified() const;

	bool RenameTo(const CFile&amp; rclFile);
	bool SetReadOnly() const;

	std::vector&lt;std::string&gt; ListFiles() const;
	std::string GetName() const;
	std::string GetParent() const;
	std::string GetPath() const;

	CFile GetParentFile() const;

	bool Exists() const;
	bool Delete() const;
	bool CreateNewFile() const;
	bool CreateNewDir() const;
};

#endif /*CFILE_H_*/
</code></pre>
<p>Implementierung sio.cpp</p>
<pre><code class="language-cpp">#ifdef WIN32
// Disable visual c++ warning C4786 
//&quot;... identifier was truncated to '255' character in the debug information
#pragma warning (disable: 4786)
#endif

#include &quot;sio.h&quot;

CFile::CFile(std::string strFileName, std::string strParentFileName) {

	m_strFileName = strFileName;
	if(strParentFileName == &quot;&quot;) {
		char buffer[256];
		if(getcwd(buffer, sizeof(buffer)) != NULL)
			strParentFileName = std::string(buffer);
	}
	m_strParentFileName = strParentFileName;
}

CFile::CFile(const CFile&amp; rclFile) {
	m_strParentFileName = rclFile.m_strParentFileName;
	m_strFileName = rclFile.m_strFileName;
}

CFile::~CFile() {

}

CFile&amp; CFile::operator=(const CFile&amp; rclFile) {
	if(this != &amp;rclFile) {
		m_strParentFileName = rclFile.m_strParentFileName;
		m_strFileName = rclFile.m_strFileName;
	}
	return *this;
}

bool CFile::IsFile() const {

	if(!Exists())
		return false;

	bool bIsFile = false;

	struct stat file_status;
	if(stat(m_strFileName.c_str(), &amp;file_status) == 0) {
		#if defined(__unix__)
		if(S_ISREG(file_status.st_mode)  || S_ISCHR(file_status.st_mode))
		#elif defined(WIN32)
		if(file_status.st_mode &amp; S_IFREG || file_status.st_mode &amp; S_IFCHR)
		#endif
			bIsFile = true;
	}
	return bIsFile;
}

bool CFile::IsDirectory() const {

	if(!Exists())
		return false;

	bool bIsDir = false;

	struct stat file_status;
	if(stat(m_strFileName.c_str(), &amp;file_status) == 0) {
		#if defined(__unix__)
		if(S_ISDIR(file_status.st_mode)) 
		#elif defined(WIN32)
		if(file_status.st_mode &amp; S_IFDIR)
		#endif
			bIsDir = true;
	}

	return bIsDir;
}

bool CFile::IsHidden() const {
	// TODO Implement it
	return false;
}

bool CFile::operator==(const CFile&amp; rclFile) const {
	// TODO Implement it
	return false;
}

bool CFile::operator!=(const CFile&amp; rclFile) const {
	// TODO Implement it
	return false;
}

std::vector&lt;std::string&gt; CFile::ListFiles() const {
	std::vector&lt;std::string&gt; vecList;

	if(!IsDirectory() || !Exists())
		return vecList;

	#if defined(__unix__)
	DIR* dir = opendir(m_strFileName.c_str());

	struct dirent* entry;
	while((entry = readdir(dir)) != NULL)
		vecList.push_back(std::string(entry-&gt;d_name));
	closedir(dir);

	#elif defined(WIN32)

	WIN32_FIND_DATA dir;
	HANDLE fhandle;
	char directory[512];
	sprintf(directory, &quot;%s\\*.*&quot;, m_strFileName.c_str());

	if((fhandle = FindFirstFile(directory, &amp;dir)) != INVALID_HANDLE_VALUE) {
		do {
			vecList.push_back(std::string(dir.cFileName));
		} while(FindNextFile(fhandle, &amp;dir));
	}
	FindClose(fhandle);

	#endif

	return vecList;
}

std::string CFile::GetName() const {
	return m_strFileName;
}

std::string CFile::GetParent() const {
	return m_strParentFileName;
}

CFile CFile::GetParentFile() const {
	return CFile(m_strParentFileName);
}

bool CFile::Exists() const {
	if(access(m_strFileName.c_str(), EXISTS) == -1)
		return false;
	return true;
}

bool CFile::Delete() const {

	if(!Exists())
		return false;

	if(access(m_strFileName.c_str(), WRITE | READ) == -1)
		return false;

	if(rmdir(m_strFileName.c_str()) == -1)
		return false;

	return true;
}

bool CFile::CreateNewFile() const {
	if(!Exists()) {
		FILE* file = fopen(m_strFileName.c_str(), &quot;w+&quot;);
		if(file == 0)
			return false;
		return true;
	}
	return false;
}

bool CFile::CreateNewDir() const {
	if(!Exists()) {

		#if defined(__unix__)
		if(mkdir(m_strFileName.c_str(), MODUS) != -1)
		#elif defined(WIN32)
		if(mkdir(m_strFileName.c_str()) != -1)
		#endif
			return true;
	}
	return false;
}
</code></pre>
<p>Viel Spass</p>
<p>Grüße<br />
Dimitrij</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049687</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049687</guid><dc:creator><![CDATA[dadrus]]></dc:creator><pubDate>Tue, 02 May 2006 15:38:55 GMT</pubDate></item></channel></rss>