How to do things
AI Noob vs. Pro

List biggest files
List newest files
Show subdir sizes
Search in files
Replace word in files
List dir differences
Send files in LAN

Free Open Source:

Swiss File Knife

a command line
multi function tool.

remove tabs
list dir sizes
find text
filter lines
find in path
collect text
instant ftp or
http server
file transfer
send text
patch text
patch binary
run own cmd
convert crlf
dup file find
md5 lists
fromto clip
hexdump
split files
list latest
compare dirs
save typing
trace http
echo colors
head & tail
dep. listing
find classes
speed shell
zip search
zip dir list

Depeche View
Source Research
First Steps

windows GUI
automation

command line
file encryption

free external tools,
zero install effort,
usb stick compliant:

zip and unzip
diff and merge
reformat xml
reformat source

cpp sources

log tracing
mem tracing
hexdump
using printf

articles

embedded
stat. c array
stat. java array
var. c array
var. java array
view all text
as you type
surf over text
find by click
quick copy
multi view
find nearby
fullscreen
bookmarks
find by path
expressions
location jump
skip accents
clip match
filter lines
edit text
highlight
load filter
hotkey list
receive text
send in C++
send in Java
smooth scroll
touch scroll
fly wxWidgets
fly over Qt
search Java

Supersonic Text File Search - Free Download

Copy and paste examples of the printf syntax, and how to use va_arg in a self-defined printf function.

example 01: printing basic datatypes

#include    // for printf

int main(int argc, char *argv[])
{
   // print "the date is: 05.01.2006",
   // i.e. 2- or 4-digit with leading zeros
   // using 32-bit 'long' datatype
   long lday   = 5;
   long lmonth = 1;
   long lyear  = 2006;
   printf("the date is: %02ld.%02ld.%04ld\n",
      lday,lmonth,lyear);

   // - print 8-digit hex value
   // - print a pointer value
   unsigned long ulID = 0x12345678;
   unsigned long *pID = &ulID;
   printf("hex value: 0x%02lX at address: %p\n",
      ulID, pID);

   // - print 4 bytes of a 32-bit ulong value
   //   as separate hex values
   unsigned char uc1 = (unsigned char)(ulID >> 24);
   unsigned char uc2 = (unsigned char)(ulID >> 16);
   unsigned char uc3 = (unsigned char)(ulID >>  8);
   unsigned char uc4 = (unsigned char)(ulID >>  0);
   printf("hex bytes: %02X %02X %02X %02X\n",
      uc1,uc2,uc3,uc4);

   // - print double value like "70.35000"
   double dTemp = 70.35;
   printf("temperature: %5.5f\n", dTemp);
}

output:

the date is: 05.01.2006
hex value: 0x12345678 at address: 0012FEDC
hex bytes: 12 34 56 78
temperature: 70.35000

example 02: string formatting

#include    // for printf
#include   // for strchr

int main(int argc, char *argv[])
{
   // - print three strings,
   //   - the first  one with 10 chars, 
   //     left-justified, and if there are 
   //     more than 10 chars, truncate rest.
   //   - the second one with 10 chars, right,
   //     prefixed with blanks
   //   - the third  one with  8 chars, right, 
   //     prefixed with zeros
   char *psz1 = "FooBar Inc. formerly known as "
                "Foo Bar Systems Corp.";
   char *psz2 = "NY";
   char *psz3 = "105000";
   // this prints one line, strings joined by compiler
   printf("company: %-10.10s | "
          "location: %10.10s | "
          "turnover: %08s$\n",
          psz1,psz2,psz3
         );

   // - find phrases in a string surrounded by < >
   // - print only the parts between < >
   char *pszFull = "This is a hello "
                   "world example.\n";
   for (char *pszCur=pszFull; *pszCur;)   // cursor
   {
      char *pszBra = strchr(pszCur, '<');
      if (!pszBra) break;
      pszBra++;   // skip '<'

      char *pszKet = strchr(pszBra, '>');
      if (!pszKet) break;

      // print n characters of a string, 
      // suppling length as int
      printf("phrase found: %.*s\n",
         (int)(pszKet-pszBra), pszBra);

      pszCur = pszKet;  // continue past phrase
   }
}

output:

company: FooBar Inc | location:         NY | turnover: 00105000$
phrase found: highlight
phrase found: /highlight

example 03:

  • writing an own printf-like function for error output
  • printing a progress indicator
#include    // for printf
#include   // for strchr
#include   // for va_arg

#ifdef _WIN32
   #define vsnprintf _vsnprintf
#endif

int main(int argc, char *argv[])
{
   // create and use an own printf-like function "perr",
   // which behaves exactly like printf, but
   // -  prefixes the output with "error: "
   // -  prints to stderr stream, not stdout
   void  perr(const char *pszFormat, ...);
   char *pszFileName = "thetestfile.txt";
   long  lStatusCode = 100;
   perr("cannot open file: %s [rc %ld]\n",
      pszFileName, lStatusCode);

   // print a progress indicator:
   //    "processing file 000 of 050 (00%) ..."
   //    "processing file 001 of 050 (02%) ..."
   //    "processing file 002 of 050 (04%) ..."
   //    ...
   //    "processing file 049 of 050 (98%) ..."
   // but always within the same line.
   long iMaxFiles=50;
   for (long iFile=0; iFile

output: (after program completion)

error: cannot open file: thetestfile.txt [rc 100]
processing file 049 of 050 (98%) ...
processing done.