Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS 

clear directory with svn files

// description of your code here
It command line clear svn directory
find d . -name .svn -exec rm -rf '{}' \; -print

Clear array in C

// Pure C code

#define LEN 40000
int a[LEN]

memset((void*)&a, 0, sizeof(int)*LEN);

C - command "ls"

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

#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>

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

	if(argc < 2)
	{
		fprintf(stderr, "%s <directory>\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;
	}
}

C - clear screen

// Simula il comportamente di clear/cls

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	// Funziona sui terminali compatibili ansi
	
	fprintf(stdout, "\033[2J"); // Cancella lo schermo
	fprintf(stdout, "\033[1;1H"); // Posiziona il cursore sulla linea colonna 1

	return EXIT_SUCCESS;
}
« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS