Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: C++ experience?, Need some help< Next Oldest | Next Newest >
chaostic Offline

Group: Members
Posts: 328
Joined: Mar. 2005
Posted: May 19 2008,23:44 QUOTE

I am trying to modify a program ( 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.
Back to top
Profile PM 
^thehatsrule^ Offline

Group: Members
Posts: 3275
Joined: July 2006
Posted: May 20 2008,04:16 QUOTE

Posting 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.
Back to top
Profile PM 
humpty Offline

Group: Members
Posts: 655
Joined: Sep. 2005
Posted: May 21 2008,04:48 QUOTE

I can't say much about C++. But being a die-hard C user,
I know many people use fprintf and fscanf to save and
read settings.
Back to top
Profile PM 
2 replies since May 19 2008,23:44 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Quick Reply: C++ experience?

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code