If you are a C or C++ programmer, you may familiar withe ungetc function in C. ungetc function is a very simple but useful function especially when your program need to read characters from a FILE stream for data parsing. You may encounter cases where you need to unread the character so that you can use that character when you pass in the FILE reference into another … [Read more...]
C#: Unix Time to .Net DateTime and Vice Versa
For some reasons, some programmer might store time values as Unix timestamp in database instead of standard SQL DateTime data type. The main reason to store time values as Unix timestamp is unknown but what I guess is for maximum database compatibility. Some old database does not support SQL DateTime data type. … [Read more...]
C# – Loop all files in directory and it’s sub-directories
Recently I need to write some code to read all files in a directory and it's sub-directories. There are simple way and difficult way (Not very difficult actually). The simple way will be writing a function that reads all files in the directory and call the function again recursively for each sub-directory in that directory. … [Read more...]