|
I have a class and i when it comes to certan error, i want my class to close entire process. Can anybody help. I am using VS2005.
|
|
|
|
|
#include <stdlib.h>
if(errHasOccured){exit(0);}
|
|
|
|
|
#include "stdlib.h" //this should be in triangle brakets
if(errHasOccured){exit(0);} //or substitute your error code where the zero is
|
|
|
|
|
I have tryied that and it doesn't work. I am asking for on MC++ forum, so i expect to get managed anser. i have also try using ExitProcess command, but when i include windows.h my compiler complains abaut a lot of errors, so this option is out.
ps: you coud just modify your post and click "Ignore HTML tags in this message (good for code snippets)"
|
|
|
|
|
Is this a console app or a GUI app? In a console app, you could just return from main, while in a GUI app, you could just close the main Form.
|
|
|
|
|
Also look at System::Environment::Exit
|
|
|
|
|
Thanks That worked. If yu must to know my app is GUI based and my class is outside of any Form.
|
|
|
|
|
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
|
|
|
|