What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » C++ help

C++ help
Author: Message:
Millenium_edition
Veteran Member
*****

Avatar

Posts: 1787
Reputation: 57
Joined: Apr 2003
O.P. C++ help
Yesterday I realized my MSN servers app was widely used... So I decided to make a new version, with new features and stuff. But i wanted to do it in c++.

My problem: i get a bug, and I don't understand why :dodgy:

I wrote this piece of code to try to get the number of servers.
code:
#include <windows.h>
#include <fstream.h>

int GetEntries(char* buffer, long int size);

int main(int argc, char* argv[])
{
    fstream servers("msnservers.dat",ios::in | ios::binary | ios::ate);
    long int fileSize;
    fileSize = servers.tellg();
    char* fileBuffer;
    fileBuffer = new char[fileSize];
    servers.seekg(0);
    servers.read(fileBuffer,fileSize);
    servers.close();
    int entries=GetEntries(fileBuffer,fileSize);
    MessageBox(0,reinterpret_cast<const char*>(entries),'\0',0);
    delete[] fileBuffer;
    return 0;
}

int GetEntries(char* buffer, long int Size) {
    char tempchar;
    int temp = 0;
    for(int i = 0; i < Size; i++) {
        tempchar=buffer[i];
        MessageBox((HWND)0,reinterpret_cast<const char*>(tempchar),'\0',0);
    }
    return temp;
}


it gives me the ugly XP crash box. (I'm using ms vc++ 6 as a compiler, and I'm happy with it.)

Now, could someone please tell me what's wrong? :)
01-25-2005 01:55 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
C++ help - by Millenium_edition on 01-25-2005 at 01:55 PM
RE: C++ help - by Concord Dawn on 01-25-2005 at 01:59 PM
RE: RE: C++ help - by Millenium_edition on 01-25-2005 at 02:09 PM
RE: C++ help - by RaceProUK on 01-26-2005 at 09:38 AM
RE: C++ help - by segosa on 01-26-2005 at 06:35 PM
RE: C++ help - by TheBlasphemer on 01-26-2005 at 06:59 PM
RE: RE: C++ help - by Millenium_edition on 01-26-2005 at 07:39 PM
RE: C++ help - by RaceProUK on 01-26-2005 at 09:06 PM
RE: C++ help - by zaidgs on 01-28-2005 at 02:50 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On