Other Software > Developer's Corner
Tiny 'Touch' 32 bits program in C (3 kb)
Gerome:
Just for fun, here's a 1kb C (well, C++) version, that has proper system return code :)
-f0dder (October 01, 2006, 02:21 PM)
--- End quote ---
Nice!
Here's a good link btw : http://smallcode.weblogs.us/category/optimization-tricks/
Gerome:
Hello,
Here is the ported version to FBSL v3 :
One cas easily compare the C version vs the FBSL one and have a look at slight difference of both languages :)
Compiled as 'tiny' Fbsl executable, it's final weight is around 8Kb.
--- Code: Text ---// ********************************// Author : Gerome GUILLEMIN// Coded in FBSL v3// Date : 01st of October 2006// ********************************#DllDeclare Kernel32( "CreateFile", "CloseHandle", "GetSystemTime", "SystemTimeToFileTime", "SetFileTime" ) Function Main() Dim %lngHandle = NULL Dim $szFileName * MAX_PATH+1 If CommandCount() = 2 Then StrCpy( szFileName, Command(1) ) lngHandle = CreateFile(szFileName, GENERIC_WRITE, _ FILE_SHARE_READ + FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0) If lngHandle AndAlso lngHandle <> INVALID_HANDLE_VALUE Then SetFileToCurrentTime( lngHandle ) CloseHandle( lngHandle ) Return 1 // => 1 will be the OK return End If End IfReturn 0 // => 0 will be the KO returnEnd Function Function SetFileToCurrentTime(Byval %hFile) Dim $ft * 16 'FILETIME Dim $st * 16 'SYSTEMTIME GetSystemTime(@st) // gets current time SystemTimeToFileTime(@st, @ft) // converts to file time format Return SetFileTime(hFile, 0, 0, @ft) // sets last-write time for fileEnd Function
See the attached Zip file to get the whole thing.
Enjoy FBSL !
Navigation
[0] Message Index
[*] Previous page
Go to full version