Wednesday, April 6, 2011

C: time/date string

http://www.thinkage.ca/english/gcos/expl/c/lib/strfti.html

#include <time.h>
length = strftime(string,maxlen,format,timestruct);

Examples:

#include <time.h> char s[30]; size_t i; struct tm tim; time_t now; now = time(NULL); tim = *(localtime(&now)); i = strftime(s,30,"%b %d, %Y; %H:%M:%S\n",&tim);

obtains the current date and time and puts it into "s" in a format like

Jan 10, 1987; 17:55:55\n




C: Printing to a file, read command line

fopen man page.

Using the in the util that save the machine IPs.


fclose man page.

Need to remember to do this.


fflush

Used to clear the file stream.


Sample C code.

fprintf(fp. "string");


Reading from the command line:


#include <stdio.h>  main(int argc, char *argv[]) { int i;  for(i = 0; i < argc; i++) 	printf("arg %d: %s\n", i, argv[i]); return 0; }

Another example:





C: time/date string

http://www.thinkage.ca/english/gcos/expl/c/lib/strfti.html

#include <time.h>
length = strftime(string,maxlen,format,timestruct);

Examples:

#include <time.h> char s[30]; size_t i; struct tm tim; time_t now; now = time(NULL); tim = *(localtime(&now)); i = strftime(s,30,"%b %d, %Y; %H:%M:%S\n",&tim);

obtains the current date and time and puts it into "s" in a format like

Jan 10, 1987; 17:55:55\n




GIT: a distributed revision control system

A comparison of revision control software.

http://en.wikipedia.org/wiki/Comparison_of_revision_control_software

A description of the 'git' revision control system.


GIT tutorial/howoto: