|
Saksida Bojan wrote: Thanks That worked. If yu must to know my app is GUI based and my class is outside of any Form.
For Windows Forms apps, Application::Exit would be a better option.
|
|
|
|
|
That one was without any effect.
|
|
|
|
|
hey folks,
I'm trying to build my project and I get the following error message:
Error 4 error C3149: 'System::String' : cannot use this type here without a top-level '^' c:\documents and settings\john\my documents\visual studio 2005\projects\rtdispatch\rtdispatch\DBConnection.h 11
Here is the entire file:
<br />
#include "StdAfx.h"<br />
#include "DBConnection.h"<br />
<br />
using namespace System;<br />
<br />
DBConnection::DBConnection(void){}<br />
<br />
static void DBConnectToDataSource(String connectString){}
static void DBDisconnectFromDataSource(void){}<br />
Whenever I attempt to use a String, I get this error message.
Do I need to instantiate an a String object or something. If so this is not what I'm looking for. I'm trying to simpl declare and define a C style char *
Any info would be great.
Thanks,
John
|
|
|
|
|
System::String does not support stack semantics, so you need to use a String^ instead of a String.
|
|
|
|
|
Thanks so much Nish, works perfectly now, I appreciate it
Thanks,
John
|
|
|
|
|
I just upgraded to VS2005.
Look This Sample:
namespace CoreSetting
{
public __gc class CoreSetting
{
public: bool bFirstRun;
public: XmlDocument ^ docXml;
public: CoreSetting()
{
}
};
}
and it gives me error:
Error 1 error C4980: '__gc' : use of this keyword
and if i remove __gc then there it teels me:
Error 1 error C3265: cannot declare a managed 'docXml' in an unmanaged 'CoreSetting::CoreSetting'
ps: i dont want to use /clr:oldSyntax
|
|
|
|
|
|
Thank you, now i can program with new sysntax style
|
|
|
|
|
Can anybody point me to any good tutorial for .NET framework 2.0 on C++.
-- modified at 10:42 Friday 25th November, 2005
|
|
|
|
|
Saksida Bojan wrote: Can anybody point me to any good tutorial for .NET framework 2.0 on C++.
You need to study the C++/CLI syntax and semantics. Once you do that, using .NET 2 features should be a natural side effect.
|
|
|
|
|
Hi,
Im looking for the source code of the Eliza (The a.i program written by Joseph Weizenbaum) program, written in c++. Would be great if someone would reply with the source code......... Thanks a Bunch
Kiddo
|
|
|
|
|
Sorry, but have you ever heard of Google? BASIC Source
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi all
I've been teaching C++ for about 10 years (unmanaged using Borland Compilers), and for the first time this year I am teaching managed C++ using MS Visual Studio .NET. The first part of the course concentrates on procedural programming in a console environment, and one of the topics is writing / reading to text files (which is OK), and printing data to a printer (local LPT1 printer). In unmanaged code, I would write is as follows :
#include
void main(void)
{
char data[80];
ifstream infile;
ofstream printer;
infile.open("TEST.TXT", ios::in);
printer.open("PRN");
while (infile)
{
infile.getline(data,80);
if (infile)
{
printer << data << "\n";
}
}
};
However, I cant find a simple way to set up a stream to the local printer in a console based environment using managed code. The file handling part is fine, and would look as follows :
// Filein1.cpp
#include "stdafx.h"
#using
using namespace System;
using namespace System::IO;
int _tmain()
{
String *record;
StreamReader * fileIn = File::OpenText(S"Test.txt");
// Need to set up stream to printer here
while ((record = fileIn->ReadLine()) != 0)
{
Console::WriteLine(S"{0}",record); // need to replace with output to printer stream
}
Console::ReadLine();
fileIn->Close();
return 0;
}
Can anyone help me fill in the gaps ?
Many thanks
Simon Cornish
Simon Cornish
|
|
|
|
|
HELLLLOOOOOOOOOOOOOOOOOOOOOO!!!!! PLEASE........!!!!!!!
|
|
|
|
|
1. don't hurry the guys that can help you, otherwise you'll have to find your answer by yourself.
2. ask the wrong forum
3. DON'T SHOUT !!!
4. be discret when it is your first posts here.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
is there anybody that know how to connect, when i enter matrik no at client side then at the admin side the statistic graph will increase everytime i enter the number. only admin can see this statistic.. please anybody know?
|
|
|
|
|
you are on a Managed C++ forum... ask your question on the right forum, respecting the rules Chris maunder exposes on his posts at the beginning of each forum (you should have a look !!!).
ask this here[^] and please redt this[^] before going further)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 3:58 Thursday 24th November, 2005
|
|
|
|
|
I have an application in which i am trying to call some dll imported function that are exported using c++ calling convention. There are couple of function exported using c calling convention. When i import all those function in my application i am able to call functions that are exported using c calling convention but not able to call functions that are exported using c++ calling convention.
any help is greatly appreciated..
thanks, Ramendra
Ramendra K
|
|
|
|
|
Hi All,
I have an issue storing derived class objects and calling their overloaded member functions. To illistrate the problem, picture this:
<br />
class Base<br />
{<br />
public:<br />
virtual void func1 (int i) { cout << i << endl; }<br />
};<br />
<br />
class A : public Base<br />
{<br />
public:<br />
virtual void func1 (int i) { cout << "i - " << i << endl; }<br />
};<br />
<br />
class B : public Base<br />
{<br />
public:<br />
virtual void func1 (int i) { cout << "i : " << i << endl; }<br />
};<br />
<br />
void global_func (Base& B) { B.func1 (1); }<br />
In this e.g. you can send A , B or Base into global_func. Now we want to link A and B together so we create a seq class and overload the operator >>:
<br />
class seq : public Base<br />
{<br />
public:<br />
seq (A _a, B _b) : m_a (_a), m_b (_b) { }<br />
A& m_a;<br />
B& m_b;<br />
void func1 (int i) { m_a.func1 (i); m_b.func1 (i); }<br />
};<br />
<br />
seq operator>> (A& _a, B& _b) { return seq (_a, _b); }<br />
Now we can write objA >> ObjB , to do both func1 in A and B at the same time. We inherit from base, because then we can pass seq in global_func . However linking a whole string together become quite irritating esp. when you use ObjA >> ObjB often.
So this is the problem, how do you store the seq generically (i.e. if there is a sequence that does B before A, but would like to it in the same object).
I thought about using a collect class:
<br />
class collect<br />
{<br />
public:<br />
collect (Base& B) : m_base (b) { }<br />
Base m_base;<br />
void func1 (int i) { m_base.func1 (i); }<br />
};<br />
But when I create the collect and global_func calls func1 , it calls it in Base not seq
Idea's, or have I just missed the plot?
thanks,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Could any one please let me know what is the use of virtual destructors?
At what point of time we use these virtual destructors?
Nice talking to you.
|
|
|
|
|
Hi,
G Haranadh wrote: Could any one please let me know what is the use of virtual destructors?
Virtual helps with derived classes. If you child class allocs memory and deallocs it in the destructor, then you will always want the child class' destructor to run. If the base class' destructor is not virtual then if the base class detructs it will not call the child class and memory will leak. When it is virtual it will call the child class before the base class.
G Haranadh wrote: At what point of time we use these virtual destructors?
When Objects destruct
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
I have a C++ app that includes a 3rd party library that has a type called
'System'. This class exists in a namespace, let's call it XYZ::System.
Then I am compiling my C++ app with /clr and somehow when VC8 includes
xlocale (which in turn uses a macro defined in yvals.h) that calls a method in .NET (System.bla.bla) there is an ambiguity.
How can I resolve this easily?
|
|
|
|
|
use ::System and XYZ::System instead of just use System
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
Well that might work for my own source code but VC8 includes VC headers that call managed code and make calls to System:: namespace classes. This means I would have to modify all of these Microsoft headers by hand for this to work, which would be impossible to do without causing all sorts of other headaches.
Is there not some way to rename a known .NET namespace to another name? Like rename ::System to ::DotNetSystem ?
|
|
|
|
|
try surrounding your include line with #define and #undef to avoid name collision..
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|