Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • My original function used std::ifstream, but I copied the one shown off the internet once I had this problem. Urgh, now I'm getting bad access on glShaderSource Commented May 28, 2010 at 9:08
  • If I make the read function use std::string, won't it need to use chars for the ifstream functions anyway? Commented May 28, 2010 at 9:18
  • @Tomas, I don't follow your second question, but it looks like you're having some trouble with pointers, so why don't you put shaders on hold for a moment and carefully work some simpler examples with pointers (including, but not only, C-style strings) until you feel more comfortable. Commented May 28, 2010 at 14:25
  • I changed my function into one which used strings instead and everything working fine - thanks for the advice. What I was trying to say one comment up was that since fstream's functions all take pointers to chars to send data back, getting it in that form then converting it to a string, only to convert it back for opengl seemed a bit redundant. In any case I found a workaround in an article somewhere which used stringstream and reader->rdbuf() - it seems like a waste of time, but hey, it works. Cheers for the advice and all Commented May 28, 2010 at 15:40