dev-cpp-users Mailing List for Dev-C++ (Page 550)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Ioannis V. <no...@ho...> - 2002-07-27 03:58:16
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Abhijit Shylanath
> Sent: Friday, July 26, 2002 11:08 PM
> To: Dev-C++ Mailing List
> Subject: [Dev-C++] Static members for callbacks
>
>
> [... back to right now...]
>
> Okay... putting eleventeen and twenty kazillion together...
> it seems you
> cannot callback to non-static member functions (i.e., you
> cannot have a
> function pointer pointing to a non-static method).
Ok.. It seems i confused subjects. I was thinking that we were talking
about some graphics classes but anyway i am reading like crazy these
days C++ and .NET and there may be some lost clusters somewhere. :)
You can have a function pointer to point to some member functions. But a
non-static member function is not a regular function, that's why we use
special-kind of pointers (a static function on the other hand is a
regular function).
#include <iostream>
int main()
{
class A
{
public:
void something() { std::cout<<"Hello, new world!\n"; }
}a;
void (A::*pf)()=&A::something;
(a.*pf)();
}
> I tried creating a class to test this, and I discovered that
> it's true...
> why?
>
> I tried callback = this->internal, testclass::internal,
> this::internal...
> yup, I got pret-ty desparate.
>
> I also tried casting the method, using type-casting
> (C-style), static_cast
> and dynamic_cast to a pointer, but it doesn't work. I get an
> error about
> converting to a pointer and compilation stops.
>
> [... back to the day I first rode a bike... hey, it's *my* post.]
Well if i understood well your problem was that you did not know how to
define a pointer to member function. Tell me if your problem was solved.
Keep coding,
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|
|
From: Matthew H. <mhi...@sy...> - 2002-07-26 22:26:43
|
>
>
>I tried creating a class to test this, and I discovered that it's true...
>why?
>
>I tried callback = this->internal, testclass::internal, this::internal...
>yup, I got pret-ty desparate.
>
>I also tried casting the method, using type-casting (C-style), static_cast
>and dynamic_cast to a pointer, but it doesn't work. I get an error about
>converting to a pointer and compilation stops.
>
>
>
I'm gathering that you are still looking to do this???
Anyhow, here's some pointers that may be of assistance. (If I
figure anything out... it's yours! 8-)
{Watch out for wordwrap... hey, it could happen...}
http://www.function-pointer.org/CCPP/callback/callback.html
http://cscene.org/topics/misc/cs7-04.xml.html
http://gethelp.devx.com/techtips/cpp_pro/10min/10min0800.asp
Those should get you started.
|
|
From: Abhijit S. <mu...@gm...> - 2002-07-26 20:08:52
|
[Today...] > That static-members issue of yours confused me. [...much, much long ago, in a land far, far away...] > Another rule > to tag on > to using static members for > callbacks. [... same land, somewhere between the two...] > I am facing a tricky problem. I have defined a class, > in which there are few funtions written for > implementing multithreading. I have a funtion named > "createThreads_()", which creates few threads. There > is another function declared in the class, "DWORD > WINAPI threadEntry_(LPVOID)". This function pointer > has been passed in the CREATETHREAD(..) call, which is > being raised as an error in VC++ compier. > It gives the error like, blah > If I use any external function Thread Function(making > it as friend to the class) then compilation is > through, WHICH IS AS EXPECTED. > Similarly, if I make the "threadEntry_(..)" in class > as STATIC and use it in CREATETHREAD(..) call then > also compilation is through. But making STATIC wont > serve my purpose. > I can go ahead with using external function by making > int as friend to the class. [... back to right now...] Okay... putting eleventeen and twenty kazillion together... it seems you cannot callback to non-static member functions (i.e., you cannot have a function pointer pointing to a non-static method). I tried creating a class to test this, and I discovered that it's true... why? I tried callback = this->internal, testclass::internal, this::internal... yup, I got pret-ty desparate. I also tried casting the method, using type-casting (C-style), static_cast and dynamic_cast to a pointer, but it doesn't work. I get an error about converting to a pointer and compilation stops. [... back to the day I first rode a bike... hey, it's *my* post.] |
|
From: Daniel G. <sp...@ho...> - 2002-07-26 13:40:19
|
It is the 26th July, 14:38 GMT and very warm in Oxfordshire. I think the list had a glitch on the 24th, I had no messages or replies. >From: "Ioannis Vranos" <no...@ho...> >To: "Dev-C++ Mailing List" <dev...@li...> >Subject: [Dev-C++] Does anyone receive this message? >Date: Wed, 24 Jul 2002 03:19:49 +0300 > >I have posted an email to the list 12 hours ago and no message has >arrived to me yet. I am posting this message at 24 July 2002 01:18 GMT. >If anyone from the list receives this message please reply. > > > >Ioannis > >* Ioannis Vranos >* Programming pages: http://www.noicys.cjb.net ><http://www.noicys.cjb.net/> >* Alternative URL: http://run.to/noicys > _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx |
|
From: Carlos d. M. <cg...@wo...> - 2002-07-26 11:47:34
|
The function is getline(buffer, number of chars);
You have getline(variable I don't see where it comes from, string), but t=
hen it
should say implicit declaration of function, expected getline(char*,int)
Did you overloaded it? If so, the error shall be inthe overloading code.
In bastring is a definition of getline (istream&, basic_string <charT, tr=
aits,
Allocator>&, charT delim =3D '\n'); but this has three parameters.
h.r...@gm... escribi=F3:
> Hi all,
>
> I always get a access violation ( access at 0x00000000) at the first ge=
tline
> command in the following codesnip. Has someone a explanition for this=
?
> Thanks in advance.
>
> greetings
> Horst
>
> codesnip:
> [...]
> bool isLine2Skip(const string& s) {
> return ( (s[0] =3D=3D ';') || // Comment
> (s[0] =3D=3D ' ') || // Space
> s.empty() ); // Empty String
> } // bool isLine2Skip
>
> bool ReadDataFile(const string& s)
> {
> try {
> ifstream in(s.c_str());
> if (!in) throw ERR_FILE_OPEN;
>
> string line;
>
> do {
> getline(in, line);
> } while (isLine2Skip(line));
> pf.MeanS =3D atof(line.c_str());
>
> [...]
>
> --
> Horst R=F6=DFner
> Postf. 1802
> 52205 Stolberg
>
> ICQ ID #74808448
> h.r...@gm...
> h.g...@t-...
>
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
>
> -------------------------------------------------------
> This sf.net email is sponsored by: Jabber - The world's fastest growing
> real-time communications platform! Don't just IM. Build it in!
> http://www.jabber.com/osdn/xim
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Daniel G. <sp...@ho...> - 2002-07-26 09:01:33
|
Can you not put them into the include bit in project settings? Not used dev for so long... >From: senem beken <sbe...@ya...> >To: dev...@li... >Subject: [Dev-C++] help!! >Date: Thu, 25 Jul 2002 05:44:50 -0700 (PDT) > >could anyone please tell me how to link multiple source file using dev >c++?? > > >--------------------------------- >Do You Yahoo!? >Yahoo! Health - Feel better, live better _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |
|
From: <ra...@am...> - 2002-07-26 08:52:52
|
Hello,
I'm new to DevC++(V4.9.4.1) and I have problems to link to libmySQL.dll.
Here is what I'm doing:
I create a new project 'GUI' using FLTK.
I copy all headers file and dll to project directory.
I create libmySQL.def file using impdef.exe from Borland BCC55.
I create libmySQL.a using dlltool.exe
I add -lmysql to 'Linker Options/Optional Libs or Object files:' on
'General' Tab from Project Options dialog
I add #include "mysql.h" and some code to create a connection to mysql
server. The project compiles but Linker reports 2 errors:
undefined reference to mysql_init@4,
undefined reference to mysql_real_connect@32.
I don't know where I want to go after that! What did I miss?
Hope someone can help me
Many thanks
__|||__
@(° °)@
----------------------------oOO--(_)--OOo----------------------------
Raphaël Bollen
Project engineer
Ampco Belgium
http://www.ampcobelgium.be
http://www.audiodeal.net
mailto:ra...@am...
Hoek 76, unit 72
2850 Boom
TEL.: 03 844 67 97
FAX: 03 844 67 46
|
|
From: Daniel G. <sp...@ho...> - 2002-07-26 07:31:50
|
Hey thanks very much for your help, that's excellent!!!!!
Daniel
>From: "Abhijit Shylanath" <mu...@gm...>
>To: "Dev-C++ Mailing List" <dev...@li...>
>Subject: Re: [Dev-C++] Constructors throwing exceptions.
>Date: Thu, 25 Jul 2002 23:28:22 +0530
>
>----- Original Message -----
>From: "Daniel Glenfield" <sp...@ho...>
>To: <dev...@li...>
>Sent: Tuesday, July 23, 2002 6:22 PM
>Subject: [Dev-C++] Constructors throwing exceptions.
>
>
> > Hello all,
> > I want my constructors (default, overloaded, and copy) to throw an
> > exception if they fail.
> >
> > 1) How do I test if the constructor has failed?
>
>--------------Start--------------------
>
>#include <iostream>
>
>using std::cout;
>using std::endl;
>
>class foo
>{
> public:
> foo()
> {
> throw "bar";
> }
>};
>
>int main()
>{
> try
> {
> foo baz;
> }
>
> catch(const char *err)
> {
> cout << "I caught\"" << err << "\" from foo" << endl;
> }
>
> return 0;
>}
>--------------Stop------------------
>
> > 2) Is it better to create an Exception class to throw exception objects,
> > rather than throwing strings and integers?
>
>I think it's better to have objects, so you can easily upgrade the
>error-handling capabilties of the program. This way, you can also have
>different attributes to an error (fatal/non-fatal, etc.) You can also make
>the error class have functions like do_what_you_have_to(), which can do
>what
>it has to (fatal errors exit, non-fatals drop a log and print a message)
>
> > 3) Where does the catch block go? In the main function after the object
>has
> > been created? Or in the constructor body?
>
>Whenever you throw something, a new object 'something' is created and
>dispatched to the catch{} block. This object's scope is similar to that of
>an object returned by the function. You can have any number of nested
>levels, as long as the level which is throw()ing is within a try{}. So you
>can have
>
>void baz()
>{
> throw new AnException("yeeppep", 23);
>}
>
>void bar()
>{
> baz();
>}
>
>void foo()
>{
> bar();
>}
>
>try
>{
> foo();
>}
>
>catch(AnException my_very_own)
>{
> // whatever
> // delete my_very_own;
>}
>
>If I typed something wrong (grammatical, not technical... no wait, maybe
>that too :), excuse me... I'm so friggin' sleepy. G'night to you all.
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by: Jabber - The world's fastest growing
>real-time communications platform! Don't just IM. Build it in!
>http://www.jabber.com/osdn/xim
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
|
|
From: David M. <ci...@ya...> - 2002-07-26 03:15:49
|
I had the exact same problem
Putting the #ifndef, #define & #endif do not work because
they are pre-processor directives. The linker never gets
to see them. When you create a project and compile you
will see for each *.cpp file a *.o file, these *.o files
are what the linker is given. The preprocessor has weeded
out it's directives before compiling even begins.
The problem you are having occours when you define a
function in more than one file. Please make shure you
are not confusing this with the definition of a function
which is just one line while the definition is all the
code you have the function execute
The .h file are supposed to contain the prototypes and
declarations
E.G.
void my_function(int param1, param2);
extern int my_varible;
class my_class {
public:
my_class();
~my_class()
private:
int x;
};
In a .cpp file put the function definitions
void my_function(int param1, int param2)
{
return;
}
...
P.S. Do not put #include "*.cpp" in the .h file or you
defeat the purpose
P.S. I had this same problem and pondered on it for a week
before I figured it out by trial & error
=====
Signed
David Mcken
Life Sucks
Live with it
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
|
|
From: <h.r...@gm...> - 2002-07-25 23:09:52
|
Hi all,
I always get a access violation ( access at 0x00000000) at the first getline
command in the following codesnip. Has someone a explanition for this ?
Thanks in advance.
greetings
Horst
codesnip:
[...]
bool isLine2Skip(const string& s) {
return ( (s[0] == ';') || // Comment
(s[0] == ' ') || // Space
s.empty() ); // Empty String
} // bool isLine2Skip
bool ReadDataFile(const string& s)
{
try {
ifstream in(s.c_str());
if (!in) throw ERR_FILE_OPEN;
string line;
do {
getline(in, line);
} while (isLine2Skip(line));
pf.MeanS = atof(line.c_str());
[...]
--
Horst Rößner
Postf. 1802
52205 Stolberg
ICQ ID #74808448
h.r...@gm...
h.g...@t-...
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
|
|
From: Ioannis V. <no...@ho...> - 2002-07-25 22:13:39
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Daniel Glenfield
> Sent: Tuesday, July 23, 2002 3:52 PM
> To: dev...@li...
> Subject: [Dev-C++] Constructors throwing exceptions.
>
>
> Hello all,
> I want my constructors (default, overloaded, and copy) to throw an
> exception if they fail.
>
> 1) How do I test if the constructor has failed?
The usual way.
void somefunc()
{
try
{
A a(1);
// ... Do your job
}
catch(failure)
{
// ...
}
}
> 2) Is it better to create an Exception class to throw
> exception objects,
> rather than throwing strings and integers?
The answer is that it is better to create an hierarchy of exceptions in
large projects. The rest is up to you.
> 3) Where does the catch block go? In the main function after
> the object has
> been created? Or in the constructor body?
You can catch exceptions thrown by other sub-objects during the
construction phase and deal with them locally, or deal with them locally
and rethrow some (or the same) exception.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ho...> - 2002-07-25 21:42:08
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Matthew Hickson > Sent: Tuesday, July 23, 2002 12:50 AM > To: 'Dev-C++ Mailing List' > Subject: Re: [Dev-C++] Copy Constructors and Overloaded > Assignment Operators > > > Hello, > > As I understand it... callback (particularly in Windows, but other UI > toolkits aswell) > need to be static class members. It pertains to the implied > "this" that > is passed to > non-static members. Causes a world of difficulty as I understand it. C++ is the child of gods. It can't be wrong. :) static members are intended for class-wide operations. > >Well i guess you can use a reset() member function with no > values stored > >in disk. > > > > > True. However, I'd be aiming to restore to a previous state... not > necessarily a "blank" initial state. Well you can create double data members, one for the previous state and one for the current state. > > To that end, I'd want to capture a state... and then update it (as > changes were accepted by the end > user), but allow a fallback to a previous state. The only other... > seemingly true OOP solution I see > is to have a property method that retains the previous value (saw > something like this mentioned in > a rogue-like game development newgroup). The only problem > being is that > it creates a ton of > member functions for maintenance. Why. > I like simplicity and conciseness in code. Too much code, or too > complex code, and it's just a > pain to maintain. You can create backup data members. The space cost can't be that large. Of course you can store everything in files, but that implies time cost. Obviously you have to make a trade off between run-time cost and memory space cost. This is not an OO problem not a C++ problem. I did not however understand why do you want to access normal data members through static member functions. If the backup values are the same for all objects you can create static data members and access them through usual member functions if you wish. That static-members issue of yours confused me. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |
|
From: Andrew J. <bu...@wo...> - 2002-07-25 18:06:09
|
hi, I call a header file (tree.h) from two c files(main.c & tree.c)... when I do this, an int fileNo gets declared twice, because the header is called twice, twice causing a linker error. I then add: #ifndef TREE_H #define TREE_H //functions and struct here int fileNo = 0; #endif for some reason that didnt keep the compiler from reading the contents of tree.h multiple times... im rather stumped, it almost seems like its ignoring all the preprocessor commands except #include altogether. i cant imagine any linker params that id need to set but im not sure. im running version 4.9.4.2 of dev and in compiler options, I have all 3 c compiler options selected. anyone have any ideas? Thanks. |
|
From: Abhijit S. <mu...@gm...> - 2002-07-25 18:00:42
|
> But, is it safe to say that everything should be okay if this methodolgy
> is used for
> in-memory state maintenance?
I guess so. But I'm still more comfortable having the class take over the
reins. This way you can take care of polymorphism and other such big words.
> >64-bit compiled program. A more portable way to persist is methods such
as
> >saveToDisk() and loadFromDisk(), which read and write each member. This
way
> >you can also change the read/write method to suit the platform... on
> >Windows, it can use the registry, on Linux the home dir, on DOS a config
> >file, etc. You could also interface to classes like FooWriter and
FooReader,
> >to which you can pass the struct/class as an argument.
> >
> >
> Use conditional compilation? (#ifdef, etc.)
You could do that, or you could have different makefiles for different
platforms using the appropriate files.
> How worried are people about bit problems (i.e. endian-ness cross
> platform, like Intel to PowerPC).
>
> I'd never really stopped to think about it until it came up ... I forget
> where now, but it was an interesting point.
I don't think this is much of an issue unless you're doing some
bit-twiddling. In which case it would be safest to store the bit-stuff in a
class which can handle the endian-ness itself. I'm not aware of any #defines
for endian-ness of the current platform. I think you can do a run-time check
like this:
if((unsigned)0x01 >> 1)
// LSB
else
// MSB
|
|
From: Abhijit S. <mu...@gm...> - 2002-07-25 18:00:19
|
----- Original Message -----
From: "Daniel Glenfield" <sp...@ho...>
To: <dev...@li...>
Sent: Tuesday, July 23, 2002 6:22 PM
Subject: [Dev-C++] Constructors throwing exceptions.
> Hello all,
> I want my constructors (default, overloaded, and copy) to throw an
> exception if they fail.
>
> 1) How do I test if the constructor has failed?
--------------Start--------------------
#include <iostream>
using std::cout;
using std::endl;
class foo
{
public:
foo()
{
throw "bar";
}
};
int main()
{
try
{
foo baz;
}
catch(const char *err)
{
cout << "I caught\"" << err << "\" from foo" << endl;
}
return 0;
}
--------------Stop------------------
> 2) Is it better to create an Exception class to throw exception objects,
> rather than throwing strings and integers?
I think it's better to have objects, so you can easily upgrade the
error-handling capabilties of the program. This way, you can also have
different attributes to an error (fatal/non-fatal, etc.) You can also make
the error class have functions like do_what_you_have_to(), which can do what
it has to (fatal errors exit, non-fatals drop a log and print a message)
> 3) Where does the catch block go? In the main function after the object
has
> been created? Or in the constructor body?
Whenever you throw something, a new object 'something' is created and
dispatched to the catch{} block. This object's scope is similar to that of
an object returned by the function. You can have any number of nested
levels, as long as the level which is throw()ing is within a try{}. So you
can have
void baz()
{
throw new AnException("yeeppep", 23);
}
void bar()
{
baz();
}
void foo()
{
bar();
}
try
{
foo();
}
catch(AnException my_very_own)
{
// whatever
// delete my_very_own;
}
If I typed something wrong (grammatical, not technical... no wait, maybe
that too :), excuse me... I'm so friggin' sleepy. G'night to you all.
|
|
From: Abhijit S. <mu...@gm...> - 2002-07-25 17:59:58
|
> > Hi all, > > > > I ported all my code from DJGPP to Dev-C++ in ansi C format. The > > compilation is ok now. > > But when I run it the program crash near at the end. > > > > I use some like 8 files to read or write in a form > > FILE *fp1 ...*fp8; > > > > fp1 = fopen(archme,"r"); > > fp2 = fopen(archme,"w"); > > > Guh! Now i noticed. You cannot do that in horizontal mode! I mean you > must not fopen() the same file more than once! You can do a shared open in Windows using CreateFile()... |
|
From: Abhijit S. <mu...@gm...> - 2002-07-25 17:59:58
|
---Original----------
2) if i try to compile a file already existing the message above doesn't
appear, but i can't use the library "winsock2.h";
in fact for every function included in it compiler says "[Linker error]
undefined reference to
'FUNCTION_NAME @ INT'" (for example, for the function "connect" the
message is "[Linker error]
undefined reference to 'connect @ 12'"); what does it mean? How could i
solve this problem?
---------------------
Add -lwsock32 under project/libraries. The Winsock functions are stored in
the libwsock32.a library, which this command makes the compiler link in.
|
|
From: Abhijit S. <mu...@gm...> - 2002-07-25 17:59:53
|
> I have 3 distinct doubts... and will write here... maybe someone can help > me. ;) > > 1) Where can i get the list of API's of Windows with prototypes and examples > of how to use or explication of each paramter of prototypes ?? :) (if > possible to download it.:)) Hongli mentioned MSDN, which is very good, but is online... this is an offline reference: http://www.borland.com/devsupport/borlandcpp/patches/BC52HLP1.ZIP > 3) How to use "format strings" with MessageBox ?? > > For example in normal i do: > > MessageBox(NULL, "File not found!!", "ERROR", MB_OK); > > Suppose that i want print "File name_of_file not found" suppose that the > name_of_file is a vector. Try this: char buf[appropriate_size]; wsprintf(buf, "This is my cool-dude message with args and stuff: %s %d", msg, some_num); MessageBox(NULL, buf, "Title", MB_OK); |
|
From: Ameer K. <sm...@vs...> - 2002-07-25 16:44:21
|
hello members, I am having a simple doubt to be clarified by the list members or by = the creators of Dev C++ The question is is it possible to create menu items to a window created = by New Projects/Window application (in DEv C++ 4.01 ) using the built in = resources editor without manually editing the rsrc file. I have tried many times and failed to add menu to the plain window = created using the Resources editor. if possible , kindly let me know the steps to follow in detail. In the example folder there are sample windows with menu items. but I = want to know whether it is possible to add menu items to the sample = plain Window created by Windows application option , using the Resources = Editor. Thank you, in advance Ameer khan sm...@vs... |
|
From: senem b. <sbe...@ya...> - 2002-07-25 12:44:51
|
could anyone please tell me how to link multiple source file using dev c++?? --------------------------------- Do You Yahoo!? Yahoo! Health - Feel better, live better |
|
From: massimo <max...@ju...> - 2002-07-25 11:34:55
|
Hi all;
i'm a young student at the first experience with programming and i have =
two problems with dev_cpp:
1) i've installed Dev-C++ 4.9.4.1 on Windows XP Professional but i can't =
use it because when i try to save or =20
compile a source file an error message saying "Access violation at =
address 00514038 in module 'devcpp.exe'. =20
Read of address 00000048." appears; what does it mean? How could i =
solve this problem?
2) if i try to compile a file already existing the message above doesn't =
appear, but i can't use the library "winsock2.h"; =20
in fact for every function included in it compiler says "[Linker =
error] undefined reference to
'FUNCTION_NAME @ INT'" (for example, for the function "connect" the =
message is "[Linker error] =20
undefined reference to 'connect @ 12'"); what does it mean? How =
could i solve this problem?
I hope somebody helps me. Thanks.
PS: i'm sorry for my very bad english!
|
|
From: Ramana K. <ra...@my...> - 2002-07-25 08:22:59
|
sounds stupid (lol) reinstall dev-c++ you are most likely missing the standard library maybe you downloaded the wrong file? you need the full big version (with mingw) -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of jim nolin Sent: Wednesday, 24 July 2002 6:10 AM To: Dev...@li... Subject: [Dev-C++] Still can't compile When I try to compile a file the error I get is "no such file or directory" regarding the ".h" library. I have taken advice like looking in the include folder to see if it was set to C:\Dev-C++\include. This may sound stupid but I have no Dev-C++ folder. I have a DevCpp icon and I have an include folder which contains 4 folders, G++, GI, ObiC, and Sys. All of these folders are empty. Perhaps I installed something incorrectly. Please help. Thank You. ______________________________________________________________________ Post your ad for free now! http://personals.yahoo.ca ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Ramana K. <ra...@my...> - 2002-07-25 08:22:47
|
Messagegot it -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of Ioannis Vranos Sent: Wednesday, 24 July 2002 10:20 AM To: Dev-C++ Mailing List Subject: [Dev-C++] Does anyone receive this message? I have posted an email to the list 12 hours ago and no message has arrived to me yet. I am posting this message at 24 July 2002 01:18 GMT. If anyone from the list receives this message please reply. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <no...@ho...> - 2002-07-25 01:49:24
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Roberto Ricardi
> Sent: Wednesday, July 24, 2002 6:59 AM
> To: dev...@li...
> Subject: [Dev-C++] Some help with ported C ansi code
>
>
> Hi all,
>
> I ported all my code from DJGPP to Dev-C++ in ansi C format. The
> compilation is ok now.
> But when I run it the program crash near at the end.
>
> I use some like 8 files to read or write in a form
> FILE *fp1 ...*fp8;
>
> fp1 = fopen(archme,"r");
> fp2 = fopen(archme,"w");
Guh! Now i noticed. You cannot do that in horizontal mode! I mean you
must not fopen() the same file more than once!
If you want to open it with read/write access in text mode without
overwriting it if it exists use:
fp1=fopen(archme, "a+");
if(!fp1)
{
printf(stderr, "Men the lifeboats. Women and children first!\n");
return EXIT_FAILURE;
}
...
fclose(fp1);
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ho...> - 2002-07-25 01:33:41
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Roberto Ricardi
> Sent: Wednesday, July 24, 2002 6:59 AM
> To: dev...@li...
> Subject: [Dev-C++] Some help with ported C ansi code
>
>
> Hi all,
>
> I ported all my code from DJGPP to Dev-C++ in ansi C format. The
> compilation is ok now.
> But when I run it the program crash near at the end.
>
> I use some like 8 files to read or write in a form
> FILE *fp1 ...*fp8;
>
> fp1 = fopen(archme,"r");
> fp2 = fopen(archme,"w");
> and so on
You must check for successful opening. If there is a failure fopen()
returns NULL.
So you should do:
fp1=fopen(archme, "r");
if(fp1==NULL)
{
fprintf(stderr, "Men the lifeboats. Women and children first!\n");
return EXIT_FAILURE;
}
etc.
>
> fprintf (fp2,"format", variables here );
> ........
> .........
> etc.
>
> Finally fclose to end it. So ...
>
> The file *fp4 looks with 0 bytes ever.
>
> the other files are not empty but look not completed at all.
>
> I see the crash zone about fclose files sentences.
> Need I do some like a flush before close the files ?
No you do not need to fflush(). Simply you probably fclose(NULL); (see
above). Or some other mistake in code you did not mention.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|