I think you could say that software lasts forever when it's author wants it to. There is plenty of dead proprietary software that dates from before the era of cloud services; it's dead because, just like the SaaS company that pulls the plug today, nobody thought (or dared) to preserve the source code.
To make sure software really lasts, history shows us that the best thing one can do is to release the code as FOSS :)
In 100 years there will probably be somebody maintaining Linux for sentimental reasons. But it probably won't be in practical use.
It's hard to imagine this happening to Linux in particular because it's ridiculously flexible. But things always change.
on the other hand, most new code sold is not designed with longevity in mind. everything has support lifetimes, and the same thing gets rehashed under new banner and sold. the incentives are not aligned for long-lasting stuff. can't have old opera buildings if the new concerts set up tents every season.
regardless, C is too big to never get worked on supporting for future hardware.
The field is generally still young, so I look forward to good solid software just getting older and older and still working well. Makes it worth learning and internalizing.
C is in its 50s, and doesn't seem to be going anywhere (:
Part of what pains me about much modern software, with its always-online and tied-to-some-cloud-service nature, is that it tends to die. The learning you do goes to waste, when some fickle company pulls the plug in the future.
I like to build stuff that lasts, whether it's a cathedral or a bazaar, and I like to use stuff that was built in that way, too.
[1] Okay, forever is a long time. Maybe some day keyboards will be extinct, and that will make keyboard-centric software obsolete. Same could be true for screens, or even the broad architecture of computing hardware as we know it. But those changes tend to happen slowly, and there's time to adapt.