Jump to content

Viper_666

Member
  • Posts

    3
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Belgium

About Viper_666

  • Birthday 05/28/1982

Contact Methods

  • Website URL
    http://

Viper_666's Achievements

0

Reputation

  1. did this a few years ago when I was in the first year of my Computer sciences graduate. The variables in the code are named in Dutch but you should get no problem seeing how the thing works or even just translate the strings and variable names for your own use... Coding isn't perfect at some places but it works 100% (as far as I can remember ) #include <stdio.h> #include <conio.h> #include <string.h> typedef struct Datum { unsigned int weekdag; unsigned int dag; unsigned int maand; unsigned int jaar; }Datum; //maanden enum{foo_dm1,januari,februari,maart,april,mei,juni, juli,augustus,september,oktober,november,december}; enum{foo_dm2,jan,feb,maa,apr,_mei,jun,jul,aug,sep,okt,nov,dec}; //dagen enum{zondag,maandag,dinsdag,woensdag,donderdag,vrijdag,zaterdag}; //formaat enum{kort,voluit_kort,voluit_lang}; #define isschrikkel (x) (!(x%4)&&((x%100) || !(x%400))) int main() { void code(); code(); puts("\n\n- Press ENTER to exit -"); getch(); } void code() { unsigned int lees_dag(); unsigned int lees_maand(); unsigned int lees_jaar(); Datum lees_datum(); int valse_datum(Datum datum); int strieq(char * string1,char * string2); int weekdag(Datum datum); unsigned int schrikkel(unsigned int jaar); void print_weekdag(unsigned int weekdag); void print_datum(Datum d,unsigned int formaat); Datum datumvandaag(); Datum datum; datum=lees_datum(); datum.weekdag=weekdag(datum); puts(""); print_datum(datum,voluit_lang); } /* Leest een dag in en controleert of deze wel kan bestaan */ unsigned int lees_dag() { unsigned int dag; do { printf(" dag : "); scanf("%u",&dag); fflush(stdin); if(dag<1 || dag>31) printf("\t *** dag moet tussen 1 en 31 liggen *** \n"); } while(dag<1 || dag>31); return (dag); } //_________________________________________________________ /* leest een maand in en controleert of deze wel kan bestaan */ unsigned int lees_maand() { char string[20]=""; unsigned int maand; do { printf("maand : "); scanf("%s",string); fflush(stdin); if(strieq("januari",string)) maand=januari; else if(strieq("jan",string)) maand=jan; else if(strieq("01",string)) maand=1; else if(strieq("1",string)) maand=1; else if(strieq("februari",string)) maand=februari; else if(strieq("feb",string)) maand=feb; else if(strieq("02",string)) maand=2; else if(strieq("2",string)) maand=2; else if(strieq("maart",string)) maand=maart; else if(strieq("maa",string)) maand=maa; else if(strieq("03",string)) maand=3; else if(strieq("3",string)) maand=3; else if(strieq("april",string)) maand=april; else if(strieq("apr",string)) maand=apr; else if(strieq("04",string)) maand=4; else if(strieq("4",string)) maand=4; else if(strieq("mei",string)) maand=mei; else if(strieq("05",string)) maand=5; else if(strieq("5",string)) maand=5; else if(strieq("juni",string)) maand=juni; else if(strieq("jun",string)) maand=jun; else if(strieq("06",string)) maand=6; else if(strieq("6",string)) maand=6; else if(strieq("juli",string)) maand=juli; else if(strieq("jul",string)) maand=juli; else if(strieq("07",string)) maand=7; else if(strieq("7",string)) maand=7; else if(strieq("augustus",string)) maand=augustus; else if(strieq("aug",string)) maand=aug; else if(strieq("08",string)) maand=8; else if(strieq("8",string)) maand=8; else if(strieq("september",string)) maand=september; else if(strieq("sep",string)) maand=sep; else if(strieq("09",string)) maand=9; else if(strieq("9",string)) maand=9; else if(strieq("oktober",string)) maand=oktober; else if(strieq("okt",string)) maand=okt; else if(strieq("10",string)) maand=10; else if(strieq("november",string)) maand=november; else if(strieq("nov",string)) maand=nov; else if(strieq("11",string)) maand=11; else if(strieq("december",string)) maand=december; else if(strieq("dec",string)) maand=dec; else if(strieq("12",string)) maand=12; else maand=0; if(maand<jan || maand>dec) printf("\n\t*** maand moet tussen 1 en 12 liggen, ***" "\n\t*** voluit zijn geschreven of de 3 eerste letters *** \n\n"); } while(maand<jan || maand>dec); return (maand); } //_________________________________________________________ /* leest een jaar in en controleert of deze wel kan bestaan */ unsigned int lees_jaar() { unsigned int jaar; do { printf(" jaar : "); scanf("%u",&jaar); fflush(stdin); if(jaar<1900 || jaar>2100) printf("\t *** jaar moet tussen 1900 en 2100 liggen *** \n"); } while(jaar<1900 || jaar>2100); return (jaar); } //_________________________________________________________ /* leest een datum in en stuurt deze terug in een struct Datum */ Datum lees_datum() { Datum d; d.dag=lees_dag(); d.maand=lees_maand(); while(valse_datum(d)) { printf("\n\t*** de ingevoerde dag en maand zijn niet geldig : ***" "\n\t*** '%u' is te groot voor maand '%u' ***\n\n",d.dag,d.maand); d.dag=0; d.maand=0; d.dag=lees_dag(); d.maand=lees_maand(); } d.jaar=lees_jaar(); return(d); } //_________________________________________________________ int valse_datum(Datum datum) { int SW=0; switch(datum.maand) { case januari : if(datum.dag>31) SW=1; break; case februari : if(datum.dag>29) SW=1; break; case maart : if(datum.dag>31) SW=1; break; case april : if(datum.dag>30) SW=1; break; case mei : if(datum.dag>31) SW=1; break; case juni : if(datum.dag>30) SW=1; break; case juli : if(datum.dag>31) SW=1; break; case augustus : if(datum.dag>31) SW=1; break; case september : if(datum.dag>30) SW=1; break; case oktober : if(datum.dag>31) SW=1; break; case november : if(datum.dag>30) SW=1; break; case december : if(datum.dag>31) SW=1; break; } return(SW); } //_________________________________________________________ unsigned int schrikkel(unsigned int jaar) { if(jaar%4==0) return(1); if(jaar%400==0) return(1); if(jaar%100==0) return(0); else return(0); } //_________________________________________________________ int weekdag(Datum datum) { int juliaanse,vieren,honderden,vierhonderden,rangorde; switch(datum.maand) { case januari : juliaanse=datum.dag; break; case februari : juliaanse=datum.dag + 31; break; case maart : juliaanse=datum.dag + 59; break; case april : juliaanse=datum.dag + 90; break; case mei : juliaanse=datum.dag + 120; break; case juni : juliaanse=datum.dag + 151; break; case juli : juliaanse=datum.dag + 181; break; case augustus : juliaanse=datum.dag + 212; break; case september : juliaanse=datum.dag + 243; break; case oktober : juliaanse=datum.dag + 273; break; case november : juliaanse=datum.dag + 304; break; case december : juliaanse=datum.dag + 334; break; } if(datum.maand>februari && schrikkel(datum.jaar)) juliaanse++; vieren=(datum.jaar-1)/4; honderden=(datum.jaar-1)/100; vierhonderden=(datum.jaar-1)/400; rangorde=((datum.jaar -1) + juliaanse + vieren - honderden + vierhonderden) %7; return(rangorde); } //_________________________________________________________ int strieq(char * string1,char * string2) { int i,lengte1=strlen(string1),lengte2=strlen(string2),lengte,SW=0; strlwr(string1); strlwr(string2); if(lengte1==lengte2) { lengte=lengte1; for(i=0;i<=lengte;i++) { if(string1[i]==string2[i]) SW=1; else {SW=0; i=lengte+1;} } } else SW=0; return (SW); } //_________________________________________________________ /* leest de standaard systeemtijd uit en slaagt deze op in een structuur datum */ Datum datumvandaag() { char string[9]; unsigned int dag,maand,jaar; Datum d; _strdate(string); dag=(unsigned int) ( ((string[3]-48)*10) + (string[4]-48) ); maand=(unsigned int)( ((string[0]-48)*10) + (string[1]-48) ); jaar=(unsigned int) ( ((string[6]-48)*10) + (string[7]-48) + 2000); d.dag=dag; d.maand=maand; d.jaar=jaar; return(d); } //_________________________________________________________ /* Print een datum structuur uit */ void print_datum(Datum d,unsigned int formaat) { char dagnaam[7][10]={"zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"}; Datum vandag=datumvandaag(); switch(formaat) { case kort : printf("%u/%u/%u",d.dag,d.maand,d.jaar); break; case voluit_kort : { printf("%s ",dagnaam[d.weekdag]); printf("%u ",d.dag); switch(d.maand) { case jan : printf("jan"); break; case feb : printf("feb"); break; case maa : printf("maa"); break; case apr : printf("apr"); break; case mei : printf("mei"); break; case jun : printf("jun"); break; case jul : printf("jul"); break; case aug : printf("aug"); break; case sep : printf("sep"); break; case okt : printf("okt"); break; case nov : printf("nov"); break; case dec : printf("dec"); break; } printf(" %u",d.jaar); }break; case voluit_lang : { printf("%s ",dagnaam[d.weekdag]); printf("%u ",d.dag); switch(d.maand) { case januari : printf("januari"); break; case februari : printf("februari"); break; case maart : printf("maart"); break; case april : printf("april"); break; case mei : printf("mei"); break; case juni : printf("juni"); break; case juli : printf("juli"); break; case augustus : printf("augustus"); break; case september : printf("september"); break; case oktober : printf("oktober"); break; case november : printf("november"); break; case december : printf("december"); break; } printf(" %u",d.jaar); } break; } }
  2. I want to install a Logitech DiNovo 2.0 on my Windows 2003 std server. In fact I upgraded hardware and did a fresh install of Windows... I managed to install the desktop on the previous computer, which was also running Windows 2003 std SP1, but I had to fiddle a bit around and I had it finaly all working with the bluetooth hub. To achieve this I must install the Logitech 2.22 setpoint drivers, which contain a WidComm bluetooth stack 3.0.1.913 silent install. To be able to run the Setpoint setup It has to be set in XP compatibility mode. The Setpoint setup calls the WidComm setup located in a subfolder. That WidComm setup cannot run in Windows XP compatibility mode. (It throws an arror telling that the current account does not have sufficent privileges to install the software for all users on the machine and to try running it logged on as Administrator, which I did and it makes no difference) So there is a problem because the setup can't go through installing the WidComm bluetooth stack and either it locks up, either it skips the bluetooth part, depending on if its a fresh install or one performed over existing software. I think this is caused by the Windows XP compatibility mode of the parent process (the Setpoint setup) being inherited by the child process (the WidComm setup). In the end resulting in the bluetooth hub not being recognized at all by windows (it's not in the Hardware manager either, otherwise I had tried a manual install) and thus leaving me with an unusable set of bluetooth devices. What could solve the problem is a way to prevent this compatibility mode to be passed on to child processes by the parent process. Or maybe there is another way to achieve an installation of the bluetooth hub ? I realy need this bluetooth hub to work again as I have to develop software for Pocket PC devices on this computer, using SQL server 2005, IIS6 and so on... Try not to come up with the already heard: "Windows 2003 aint a workstation" I don't use it as a workstation, I use it as a development environment and server. The DiNovo 2.0 was a nice package, containing all I needed for the BT aspect of my mobile projects and could bring me a nice keyboard for typing on all day long... Thanks for reading the long post, and helping me out installing this hardware.
×
×
  • Create New...