Forum: Programming and Scripting
Topic: C++ experience?
started by: chaostic
Posted by chaostic on May 19 2008,23:44I am trying to modify a program (Mixer.app 1.8.0) so it will save and load all its options to/from a settings file. It already saves the previous volume settings, but I would like to be able to save the channel sources (as a name, not a number), the mute status, the mixer device, the display number (not really needed), the wheelbutton source, Label Text and Instance Name.
The numbers are easy (Volume and WheelButton source), I just copied the code it already has. The text options is what are hard. Sure, I can keep mute as a 0 or 1, and the source as a number (1-25 depending on the source name), but that doesn't make the settings file easy to manually edit. Plus the text options like mixer device, or Label text can't be converted to a number.
From my point of view, this should be easy to anyone who has some experience with reading strings or chars from a fixed layout file, but when I try to make changes to it, my changes segfault (only when loading the file/settings. It saves them okay) Of course, I never learned C++, just java, and looking online, my changes should work. On top of that, adding c++ code to print to cout doesn't seem to work. Then again, segfaulting might happen before it gets a chance to finish processing the couts?
Any help would be appreciated. PM me if you want what I already have. Thanks.
Posted by ^thehatsrule^ on May 20 2008,04:16Posting your code changes and what you're changing in the settings file might make it clearer what's going wrong. If it's too long, then maybe just posting one instance of the changes would do it.
Posted by humpty on May 21 2008,04:48I can't say much about C++. But being a die-hard C user,
I know many people use fprintf and fscanf to save and