Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 3rd, 2005, 5:57 PM   #1
Daniel_kd
Newbie
 
Daniel_kd's Avatar
 
Join Date: Apr 2005
Posts: 22
Rep Power: 0 Daniel_kd is on a distinguished road
Post About functions

I started studing C last monday so please don't acuse me for a too stupid way. Yesterday I wrote a "library" to read and write ini files which is ok. But in the h file I have a few functions that are used internally. Is there a way to make them unavailable to the other files that use this c file(like declaring them private as in VB)?
Thanks in advance
Daniel_kd is offline   Reply With Quote
Old Apr 3rd, 2005, 6:54 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
If you write the library as a class, you can have public and private sections.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 4th, 2005, 7:09 AM   #3
Daniel_kd
Newbie
 
Daniel_kd's Avatar
 
Join Date: Apr 2005
Posts: 22
Rep Power: 0 Daniel_kd is on a distinguished road
can you do this in c? and how do you do it? I tried this function decleration in the .h file and it didn't work out

private char *clearchar(char *string, char *what);
Daniel_kd is offline   Reply With Quote
Old Apr 4th, 2005, 7:49 AM   #4
Mad_guy
Hobbyist Programmer
 
Mad_guy's Avatar
 
Join Date: Oct 2004
Location: Sandstorm, Techno Club
Posts: 239
Rep Power: 4 Mad_guy is on a distinguished road
Send a message via AIM to Mad_guy Send a message via MSN to Mad_guy
You have to use a C++ class to do it, like this:

class OmgWtf {
public:
 int yey;
 char grr;
 OmgWtf();
protected:
 ~OmgWtf();
private:
 nottobeseen();
};

Bad example, but I think you get the idea.

I suggest you learn more C first before you get into C++ classes. They're not that difficult though.
And, just from my point of view, you should only use a class when it's needed (such as a game or large scale application.) Since it'll bloat your applications a bit.

Last edited by Mad_guy; Apr 4th, 2005 at 7:52 AM.
Mad_guy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC