What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! Help » Plugin Help C++ opening file

Plugin Help C++ opening file
Author: Message:
crank
Full Member
***

Avatar
Failed to come back here :(

Posts: 304
Reputation: 17
35 / Male / Flag
Joined: Mar 2004
Status: Away
O.P. Huh?  Plugin Help C++ opening file
I'm working at QTSender during my spare time(when i'm not fixing MSNBrowser).

I found a code for a file but I can't make it really work.

Headers:
code:
#include <fstream.h>
#include <iostream.h>

Code:
code:

            char str[1100]; //set string lenght

            int nRandom = rand()%3;

            if(nRandom == 0)
                ifstream b_file("QTS1.txt");//opens file for reading
                b_file>>str; //reads one string from file
                strcpy(sResult, str); //output text
                b_file.close();//close file


Build/Debug Log:
code:
MPPluginC.cpp
c:\documents and settings\kenneth\mijn documenten\msgplus!plugin source\qts(openfiletest)\vc\mppluginc\mppluginc.cpp(96) : error C2065: 'b_file' : undeclared identifier
c:\documents and settings\kenneth\mijn documenten\msgplus!plugin source\qts(openfiletest)\vc\mppluginc\mppluginc.cpp(96) : error C2297: '>>' : illegal, right operand has type 'char [1100]'
c:\documents and settings\kenneth\mijn documenten\msgplus!plugin source\qts(openfiletest)\vc\mppluginc\mppluginc.cpp(98) : error C2228: left of '.close' must have class/struct/union type
c:\documents and settings\kenneth\mijn documenten\msgplus!plugin source\qts(openfiletest)\vc\mppluginc\mppluginc.cpp(102) : error C2297: '>>' : illegal, right operand has type 'char [1100]'
c:\documents and settings\kenneth\mijn documenten\msgplus!plugin source\qts(openfiletest)\vc\mppluginc\mppluginc.cpp(104) : error C2228: left of '.close' must have class/struct/union type
c:\documents and settings\kenneth\mijn documenten\msgplus!plugin source\qts(openfiletest)\vc\mppluginc\mppluginc.cpp(106) : error C2181: illegal else without matching if
Error executing cl.exe.

MPPluginC.obj - 6 error(s), 0 warning(s)

(If you copy this to notepad it will be easier to read)

My question is how to fix those errors???
Or is the code to open the file wrong???
What should i change the >> too???

I know most of these are 'beginner' faults but i just can't work with files in C++
Fixed some stuff myself (the bold stuff)

This post was edited on 08-12-2004 at 02:11 PM by crank.
I haven't been active here in ages.
If you're wondering who i am, read my reputations. I used to make plugins, skins and spam the IRC channels here back in the good old days before Windows Live.
08-12-2004 02:02 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Plugin Help C++ opening file - by crank on 08-12-2004 at 02:02 PM
RE: Plugin Help C++ opening file - by RaceProUK on 08-13-2004 at 09:51 AM
RE: Plugin Help C++ opening file - by crank on 08-13-2004 at 05:23 PM
RE: Plugin Help C++ opening file - by RaceProUK on 08-13-2004 at 06:53 PM
RE: Plugin Help C++ opening file - by crank on 08-17-2004 at 01:35 PM
RE: Plugin Help C++ opening file - by Tochjo on 08-17-2004 at 01:40 PM


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