Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by MemoryLeak

  1. MemoryLeak

    Timestamps

    If you want OS independence use the C runtime library. This should work for UNIX, Windows, and DOS going back several revs. #include <time.h> #include <sys/types.h> #include <sys/stat.h> . . . struct _stat s; if ( 0 == _stat( &quot;c:\\somepath\\somefile.ext&quot;, &s ) ) { /* the...
  2. MemoryLeak

    Most recent file in folder...

    #include <windows.h> BOOL FindLatestFile(TCHAR* pPath,TCHAR* pLatestFile); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { TCHAR cFile[_MAX_PATH]...
  3. MemoryLeak

    Time/Date problem on NT4

    You need to set t to something. For example to do the current time: time_t t; t = time(NULL); <--- printf(ctime(&t));
  4. MemoryLeak

    VB guy needs help with real code.

    Something like Function IS_NewPalletNumber() As String Dim GrafTable As String GrafTable = &quot;0123456789ABCDEFGHJKLPQRTUVYX#&quot; . . . . IS_NewPalletNumber = Mid$(GrafTable,_ 10 + (PalletSeed \ 1000) + 1, 1) _ & Format$(PalletSeed Mod 1000...
  5. MemoryLeak

    implementing substring in C

    anand102, In case you're not trying to implement 'substr' as some sort of training assignment: The C run-time library has a function that does this for you - strstr. Regards
  6. MemoryLeak

    How to identify a CR and LF

    Just so nobody gets confused... '\r' is the same as 13 and '\n' is the same as 10 Regards
  7. MemoryLeak

    Date functions - date arithmatic in C?

    There's a bunch of ways of doing this (e.g., mktime). This is a fairly straightforward method: struct tm *ptm; time_t t; time(&t); // get current time t -= 9 * 24 * 60 * 60; // subtract 9 days from now ptm = localtime(&t); // convert to struct tm
  8. MemoryLeak

    DLL in C for Visual Basic : parameter passing

    This is what I use. Don't forget to free the returned TCHAR* when you're done with him. TCHAR* GetTCHAR(BSTR str) { UINT uiLen; TCHAR* s; uiLen = SysStringLen(str); s = (TCHAR*)calloc(uiLen+1,sizeof(TCHAR)); if(s) { if(str) { #ifdef UNICODE...

Part and Inventory Search

Back
Top