From aaff5572f054045ecd4dd94ccdc2caac71132ad4 Mon Sep 17 00:00:00 2001 From: Mateusz Kaduk Date: Thu, 30 Jun 2005 20:45:43 +0000 Subject: Improved buddylist, added talk --- src/resources/buddylist.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/resources/buddylist.cpp') diff --git a/src/resources/buddylist.cpp b/src/resources/buddylist.cpp index 9772ff19..9f11b5f7 100644 --- a/src/resources/buddylist.cpp +++ b/src/resources/buddylist.cpp @@ -42,7 +42,7 @@ BuddyList::~BuddyList() void BuddyList::loadFile(void) { - char buddy[LEN_USERNAME]; + char *buddy; // Open file std::ifstream inputStream(filename->c_str(), std::ios::in); @@ -52,8 +52,11 @@ void BuddyList::loadFile(void) } do { + buddy = (char *) calloc(LEN_USERNAME, sizeof(char)); inputStream.getline(buddy, LEN_USERNAME); - buddylist.push_back(buddy); + // Ugly ? + if(strcmp(buddy,"") != 0) buddylist.push_back(buddy); + free(buddy); } while(!inputStream.eof()); // Read buddy and close file -- cgit v1.2.3-70-g09d2