Much of Ecclesiastes was obviously written to illustrate the perspective of a person who had lost much of his faith. These passages of scripture allow Bible readers to see how such a spiritually lost person views the world. God inspired their writing and saw to it that they were contained in the scriptures for this reason.
Of course today all of us here have the Internet and JWD. So, if any one here does not have a Bible handy to read Ecclesiates and see how such a spiritually lost person views life, we can just read one of Joseph Alward's posts.