Shuffle That Playlist

Recently, I created a playlist of songs on a certain online subscription service. I chose to shuffle the tunes, but found that one song in particular played more often than the others. My immediate thought was, “Why can’t the programmers design a shuffled playlist that doesn’t overplay the same song”? Rather than email the programmers, I thought I’d present the puzzle as this month’s Exercise.
Continue reading

Reading a Directory

I’m refusing to call it a “folder.” That nonsense gained popularity with the Macintosh and then Windows. Before then, it was a directory, a list of files stored on media. Special C language functions are available to read and manipulate directories, which helps your programs manage files and do other fun file stuff.
Continue reading

What Evil Lurks in a Header File . . . ?

As a beginner, your first exposure to a header file is most likely <stdio.h>, which you understand is necessary for some reason. Then you may confuse the header file with the library, which is common but wrong. And you may even dabble with your own header files. Beyond that, few tutorials bother to mention any necessary details about what should go into a header file and when it’s necessary . . . until now.
Continue reading