create new tag
view all tags

#include <stdio.h>
#include <fcntl.h>
#include <errno.h>

int main(int argc, char *argv[]) {
	 int i,n,f;
	 char buffer[256];

	 if (argc!=3) {
		  printf("Uso: %s <intero positivo> <nomefile>\n",argv[0]);


	 f=open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 00644);

	 if (f==-1) {
		  printf("Non riesco ad aprire il file!\n");

	 for (i=1; i<=10; i++) {
		  sprintf(buffer,"%2d x %2d = %3d\n",n,i,i*n);
		  if (write(f,buffer,strlen(buffer))==-1)
				printf("Non riesco a scrivere! Errore: %d\n",errno);


-- AntonioValletta - 12 Nov 2001
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2001-11-26 - AntonioValletta

Questo sito usa cookies, usandolo ne accettate la presenza. (CookiePolicy)
Torna al Dipartimento di Informatica
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback