Can anyone explain me how to convert a date with the format YYYYWWD (where WW is weeknumber an D is day (1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday) to YYYYMMDD.
Xander80
Posts
-
Date format -
voice masking ...plz helpMaybe this url helps: http://digitalfilter.com/vcclass.html.
-
key pressI found something, but I don't know if it's usefull. MSDN: _getch Requirements _getch <conio.h> Win 98, Win Me, Win NT, Win 2000, Win XP Return Value Returns the character read. There is no error return. Remarks The _getch and _getwch functions read a single character from the console without echoing. _getche and _getwche read a single character from the console and echo the character read. None of these functions can be used to read CTRL+C. When reading a function key or an arrow key, each function must be called twice; the first call returns 0 or 0xE0, and the second call returns the actual key code. That would make:
char ch; ch = _getch(); ch = _getch(); //each function has to be called twice to read function or arrow keys
Don't forget:#include <conio.h>
-
!strcmpAgain I'm sorry :zzz::zzz::zzz: (I must be sleeping). When you compare 2 strings with strcmp(), this function returns 0, so strcmp("codeproject","codeproject") returns 0. That will result in if (!0). NOT 0 is 1, so when the 2 strings are identical, the result is displayed on screen with cout. Check by watching the result var in the debugger:
int result = strcmp(str, Info[i]); if(!result) { cout<<"\nInformation:"< If result == 0 then the information is displayed. Maybe it's better to rewrite the code to: `if (strcmp(str, Info[i])==0) { cout<<"\nInformation:"< so it's perfectly clear that the if statement checks for identical strings (for less experienced programmers like me :~ ). :wtf::wtf:`
-
!strcmp:eek: Oh no, sorry. The function returns 0 when the strings are equal. That would make: if (!0) So only when the strings are not equal, the code in the if statement gets executed, and the next in the info array is printed to screen (Info[i+1]). I'm sorry, it's very early in the morning (in Holland):zzz:, and I hadn’t finished my coffee. :~ :laugh:
-
!strcmpThe strcmp function returns 0 when string1 is identical to string2. The application writes the info to screen when string1 is identical to string2.
-
Deciphering memory leak dumpI use: #define _CRTDBG_MAP_ALLOC #include at the top of my application, and: _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); at the start of my application (first function). More information about the object that caused the memory leak will appear in the debug information.
-
how to add Mouse Buttons in C++.NETSelect the resource (dialog) where you want to add the mouse buttons to, in your resource view. Right click on the resource in the right document view. Select properties from the pop-up menu. A new window appears, click on Control Events in the toolbar. This shows all events for all the controls in your resource.
-
Will the professional programmers please help me here with my DieClass?I've changed a few things in youre code. Does this work??? // DieTest.cpp // the driver #include "Die.h" #include <iostream.h> void main() { Die d1, d2; Die d3(10), d4(100); cout << "d1\td2\td3\td4" << endl; for (int i=0; i<10; ++i) { d1.roll(); // roll() is modifier d2.roll(); d3.roll(); d4.roll(); cout << d1.getValue() << '\t'; // getValue() is asscessor cout << d2.getValue() << '\t'; cout << d3.getValue() << '\t'; cout << d4.getValue() << '\t'; } cin.get(); } // Die.cpp // the implementation #include <stdlib.h> #include <time.h> #include "Die.h" Die::Die() // Die() is a constructor { nSides = DEFSIDES; value = 1; } Die::Die(int sides) { nSides = sides; value = 1; srand( (unsigned)time( NULL ) ); } void Die::roll() // roll() is a modifier { value = (rand()%nSides)+1; } int Die::getValue() { return value; } //Die.h // the header #ifndef DIE_h #define DIE_h const int DEFSIDES = 6; class Die { public: // constructor Die(); Die(int); void roll(); // modifier int getValue(); // asscessor private: int nSides; int value; }; #endif
-
How to get the size of a physical disk?Does this help??? :confused::confused: LPCTSTR lpDirectoryName; // directory name ULARGE_INTEGER lpFreeBytesAvailable; // bytes available to caller ULARGE_INTEGER lpTotalNumberOfBytes; // bytes on disk ULARGE_INTEGER lpTotalNumberOfFreeBytes; // free bytes on disk lpDirectoryName = "c:"; lpFreeBytesAvailable.QuadPart = 0; lpTotalNumberOfBytes.QuadPart = 0; lpTotalNumberOfFreeBytes.QuadPart = 0; FARPROC pGetDiskFreeSpaceEx; pGetDiskFreeSpaceEx = GetProcAddress( GetModuleHandle("kernel32.dll"), "GetDiskFreeSpaceExA"); if (pGetDiskFreeSpaceEx) { GetDiskFreeSpaceEx (lpDirectoryName, (PULARGE_INTEGER)&lpFreeBytesAvailable, (PULARGE_INTEGER)&lpTotalNumberOfBytes, (PULARGE_INTEGER)&lpTotalNumberOfFreeBytes); } else { AfxMessageBox(_T("Error")); }
-
Convert "unsigned char[8]" to longDoes this example help??? Found it on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_atof.2c_.atoi.2c_._atoi64.2c_.atol.asp[^] char *s; long l; s = "98854 dollars"; /* Test of atol */ l = atol( s ); printf( "atol test: \"%s\"; long: %ld\n", s, l ); Output atol test: "98854 dollars"; long: 98854
-
Why should I use XML in my website, when I’ve got a database driven website?Thanks!!!
-
Why should I use XML in my website, when I’ve got a database driven website?I’m new to XML. I read on http://www.w3schools.com/[^] that it’s important to understand that XML was designed to store, carry, and exchange data. XML was not designed to display data. Why should I use XML in my website, when I’ve got a database driven website, and all my data is located in that database?
-
Are there some reference about how to use auto_ptr? -
Why are cats so stupid ?It's just like the "system restore" option in XP. If you’re in danger, return to a previous "safe spot".
-
a doubt ?I'm not sure, but I think that someobject *var=new someobject[100]; delete var; frees alocated memory and someobject *var=new someobject[100]; var=null; changes the pointer to null