Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Best way to remember state between runs

$
0
0

@windspirit wrote:

Hello, I’m working on an image playlist kiosk thing for the raspberry pi. I want to be able to select an image out of a bunch of images in a file and then have that image be the one to load when the program is loaded next. Usually how I do this in a basic C++ program is by saving the index of the image that I want to a text file and then read that text file next time I open the program and load it into the image index.

Seems like this is definitely possible in open frameworks but I am having some difficulty with the way that text files are read and written in OF. It seems like things are usually done by reading to a buffer and then you manipulate the contents of the buffer. I am a bit confused by the way that the ofBuffer documentation is set up and I was not able to find very many examples online of how to work with buffers. I see ofBuffer.getData(); which returns a pointer but does not take any arguments. I am guessing that it just reads from the input buffer one character at a time? If so does ofBuffer.rBegin(); cause the buffer to start reading from the beginning again?

I also found this thread which suggested a different method of reading from files with no buffer but it does not seem to work in my program. Reading chunks of text from file but not whole file

If there is another, simpler way of dealing with this issue I am all ears.

Any help is appreciated.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles