Platinum Partner

C - Command "ls"


/*
 *
 * Esempio che scansiona una cartella stampando a video i file in essa
 * contenuti.
 */

#include 
#include 
#include 
#include 

int main(int argc, char *argv[])
{
	DIR *dir;
	struct dirent *drent;

	if(argc < 2)
	{
		fprintf(stderr, "%s \n", argv[0]);
		return EXIT_FAILURE;
	}

	if((dir = opendir(argv[1])) == NULL)
	{
		fprintf(stderr, "Errore opendir()\n");
		return EXIT_FAILURE;
	}

	while((drent = readdir(dir)) != NULL)
	{
		fprintf(stdout, "--> %s\n", drent->d_name);
	}
	
	if(closedir(dir) < 0)
	{
		fprintf(stderr, "Errore closedir()\n");
		return EXIT_FAILURE;
	}
}
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}