Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ======C Build string====== This is useful when you are constantly compiling a program and can't remember what version is on what machine. It will generate a C file that can then be compiled into your software. The executable was compiled under the cygwin environment so you will need this environment to be able to run this program. {{compiled.c}} {{compiled.exe}} Alternatively if you only have dos then you can download the {{cygwin1.dll}} and put this file in same location as the exe. <code c> #include <stdio.h> #include <time.h> static const char *mon_name[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; int main(void) { struct tm *timeptr; time_t clock; char s[200]; clock = time(NULL); timeptr = localtime(&clock); sprintf(s, "%d-%s-%02d %.2d:%.2d", timeptr->tm_mday, mon_name[timeptr->tm_mon], timeptr->tm_year % 100, timeptr->tm_hour, timeptr->tm_min ); printf("const char *compiled=\"%s\";\n", s); return(0); } </code> This would be called from your makefile like this. <code> $(NAME).app : compile $(OBJ) @echo linking... @$(CC) -R0 $(OBJ) $(LIBS) @res/filer.list -o $@ compile: @..\compiled >src/compiled.c </code> Then all you would have to do is make sure you reference the date constant using the following code block. <code c> extern char *compiled; </code> {{tag>cybiko}} cybiko/buildstring.txt Last modified: 2009/11/27 17:54by 127.0.0.1