<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://so.v2.cs.unibo.it/wiki/index.php?action=history&amp;feed=atom&amp;title=ProvaPratica_2010.02.03</id>
	<title>ProvaPratica 2010.02.03 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://so.v2.cs.unibo.it/wiki/index.php?action=history&amp;feed=atom&amp;title=ProvaPratica_2010.02.03"/>
	<link rel="alternate" type="text/html" href="https://so.v2.cs.unibo.it/wiki/index.php?title=ProvaPratica_2010.02.03&amp;action=history"/>
	<updated>2026-04-30T18:32:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://so.v2.cs.unibo.it/wiki/index.php?title=ProvaPratica_2010.02.03&amp;diff=603&amp;oldid=prev</id>
		<title>Stefano 92: Created page with &quot;&lt;h1&gt;http://www.cs.unibo.it/~renzo/so/compiti/2010-02-03.pdf&lt;/h1&gt;   == Esercizio 1 ==  &lt;syntaxhighlight lang=&quot;C&quot;&gt;  #include &lt;stdio.h&gt; #include &lt;sys/types.h&gt; #include &lt;dirent.h&gt;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://so.v2.cs.unibo.it/wiki/index.php?title=ProvaPratica_2010.02.03&amp;diff=603&amp;oldid=prev"/>
		<updated>2014-04-28T13:57:43Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;h1&amp;gt;http://www.cs.unibo.it/~renzo/so/compiti/2010-02-03.pdf&amp;lt;/h1&amp;gt;   == Esercizio 1 ==  &amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;  #include &amp;lt;stdio.h&amp;gt; #include &amp;lt;sys/types.h&amp;gt; #include &amp;lt;dirent.h&amp;gt;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;h1&amp;gt;http://www.cs.unibo.it/~renzo/so/compiti/2010-02-03.pdf&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Esercizio 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
#include &amp;lt;dirent.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/stat.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int N_DIR1=0;&lt;br /&gt;
&lt;br /&gt;
void print_reverse(char**ptr)&lt;br /&gt;
{&lt;br /&gt;
	int i=0;&lt;br /&gt;
	for(i=N_DIR1-1;i&amp;gt;-1;i--)&lt;br /&gt;
		printf(&amp;quot;%s\n&amp;quot;,ptr[i]);&lt;br /&gt;
}&lt;br /&gt;
int main ()&lt;br /&gt;
{&lt;br /&gt;
	int ris,i=0;&lt;br /&gt;
	char c;&lt;br /&gt;
	char*tmp;&lt;br /&gt;
	struct stat prova;&lt;br /&gt;
	char**filedir1=NULL;&lt;br /&gt;
	DIR *dp; &lt;br /&gt;
	struct dirent *ep; &lt;br /&gt;
	/*APERTURA DIRECTORY 1*/&lt;br /&gt;
	dp = opendir (&amp;quot;.&amp;quot;);&lt;br /&gt;
	if (dp != NULL)&lt;br /&gt;
	{&lt;br /&gt;
		while ((ep = readdir (dp))) /*Leggo i file nella directory*/&lt;br /&gt;
    	{&lt;br /&gt;
    		ris=lstat(ep-&amp;gt;d_name,&amp;amp;prova); /*Recupero le informazioni sul file*/&lt;br /&gt;
    		if (S_ISREG(prova.st_mode)) /*file regolare*/&lt;br /&gt;
    		{ &lt;br /&gt;
    		/*IL FILE E' UN ESEGUIBILE REGOLARE*/&lt;br /&gt;
    			N_DIR1++;&lt;br /&gt;
    			filedir1=(char**)realloc(filedir1,N_DIR1*sizeof(char*));&lt;br /&gt;
    			filedir1[N_DIR1-1]=ep-&amp;gt;d_name;&lt;br /&gt;
    		}&lt;br /&gt;
		}&lt;br /&gt;
		closedir (dp); /*ORA IN filedir1[] CI SONO TUTTI I FILE DELLA DIRECTORY 1*/&lt;br /&gt;
	}&lt;br /&gt;
	print_reverse(filedir1);&lt;br /&gt;
	return(0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
-stefano92&lt;br /&gt;
&lt;br /&gt;
nota: non ho usato la qsort, ma ho semplicemente utilizzato il fatto che readdir() restituisce il contenuto in ordine alfabetico. E' corretto?&lt;/div&gt;</summary>
		<author><name>Stefano 92</name></author>
	</entry>
</feed>