Agreed with Tony. The markets provide several things for companies that sell their stock through them: they provide a forum in which to sell that reduces transaction costs of individual sales, they protect the investor by publishing the price instantaneously and keeping prices stable, and they "make a market" when prices are unstable.
The investor would be hurt by companies selling their stocks directly. The market immediately reflects the current going price, while companies could sell shares at different prices to different investors without a stock market.