Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (-1) | Shanky.com
Delete Funcation!

 
Post new topic   Reply to topic Printable version
 View previous topic  Ships start with 3000+ 'Green' points Post :: Post moving problems...  View next topic  
Author Message
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Fri Jan 09, 2004 9:22 pm    Post subject: Delete Funcation! Reply to topic Reply with quote

I'm trying too make a Link List for my Msg Board thingy and I need too know how too delete like a user entry out of my link list let me show you the link list that I'm work with:
Code: Show/Hide

class boardUdata{
public:
   int UserID;
   char Name[32];
   char Email[100];
   char Sig[256];
   char title[32];
   int posts;
   int warnlevel;
   int Level;
   bool banned;
   bool limitread;
   boardUdata* Next;
};

and I want too be able too have it search the Name Var in the list and then delete that whole entry that the name is found in. I hope you undestand what I just said because I'm kinda tired so I'm just typing.
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Jan 09, 2004 11:13 pm    Post subject: Reply to topic Reply with quote

Why don't you just use the ANSI list datatype?
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
-Smong-
Guest


Offline

PostPosted: Sat Jan 10, 2004 3:58 pm    Post subject: Reply to topic Reply with quote

Do a strcmp() on the Name of every link until you get a match. Lets say the matching link is 'foo' and the previous link is 'bar', then:
Code: Show/Hide
bar->Next = foo->Next;
free(foo);
Back to top
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Sun Jan 11, 2004 9:32 pm    Post subject: Reply to topic Reply with quote

Cyan~Fire wrote:
Why don't you just use the ANSI list datatype?


I nevered used it but if it is a better way I would.
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Jan 12, 2004 5:39 pm    Post subject: Reply to topic Reply with quote

Well ANSI C++ has a built in linked list. It's pretty useful (dunno why Catid didn't use it in MERVbot).

Check out the MSDN library page on it.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Versetti
Novice


Gender:Gender:Male
Joined: Jan 05 2004
Posts: 54
Offline

PostPosted: Mon Jan 12, 2004 9:17 pm    Post subject: Reply to topic Reply with quote

ARGH I think this means I have too remake just about the whole Database part!!!!

..............I thought there was a stupid delete thingy that I can code into a funcation that will work :-I .......... Grrrrr

that MSDN does not explain it too good. O well gr.
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
ExplodyThingy
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Dec 15 2002
Posts: 528
Location: Washington DC
Offline

PostPosted: Mon Jan 12, 2004 9:38 pm    Post subject: Reply to topic Reply with quote

The delete thingy needs to get the previous item in the list and point it to the next tiem. You need to do this->last->next=next; and this->next->last=last; in order to point around the old node. Then simply delete it.
_________________
There are no stupid question, but there are many inquisitive idiots.
Loot

Dr Brain> I hate clean air and clean water. I'm a member of Evil Conservitive Industries
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Jan 13, 2004 5:30 pm    Post subject: Reply to topic Reply with quote

Lol well you don't have to use it if you don't want to, I was just suggestion a pre-made one to help you out icon_razz.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:42
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3616
Location: Las Vegas
Offline

PostPosted: Wed Jan 14, 2004 10:26 am    Post subject: Reply to topic Reply with quote

Remember, if you create the link via new, you'll need to free it via delete. If you create it via malloc, you'll need to free it via free. Don't mix the two methods.
Back to top
View users profile Send private message Add User to Ignore List Send email
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> General Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 43 page(s) served in previous 5 minutes.

phpBB Created this page in 0.216131 seconds : 33 queries executed (85.2%): GZIP compression disabled