How to apply a patch to a library

Hi,

for a project I need a certain modification of the LedControl library. I found exactly what I need here:

There is a patch for the library for download in that article (common-anode.patch). My question is, how to apply this patch to that library. I could not find any information about this; so I would be happy if someone could give me an instruction or a link.

Thanks in advance,
Walter

If you open the file attached in that thread using Notepad++, the lines in blue are the ones to add to the library. The ones in green are the ones to remove.

Obviously, the file is a delta file that github is supposed to know how to apply. Why the doofus didn't just supply the result of apply that patch is a mystery. Another reason to dislike shithub.

Thanks your for the fast reply,
I hoped there was a smarter way to do this rather than doing it manually. :cry:

Walter

There probably is, if you have a github account.

Here is a patched fork.

As there are newer commits (than both the patch and whats in the playground), some parts were rejected.

You can see the stuff rejected in: LedControl.cpp.rej

Here is what I used in GIT: git apply --reject --whitespace=fix --ignore-space-change --ignore-whitespace common-anode.patch