dev-cpp-users Mailing List for Dev-C++
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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
1
(1) |
2
|
3
(2) |
4
(3) |
5
(4) |
6
(2) |
7
(5) |
8
(6) |
9
(5) |
10
(3) |
11
(2) |
12
(2) |
13
|
14
(2) |
15
|
16
(7) |
17
(3) |
18
|
19
|
20
(9) |
21
|
22
|
23
(2) |
24
(4) |
25
(3) |
26
(2) |
27
(2) |
28
(8) |
29
(2) |
30
(5) |
|
From: Hooda, N. <nee...@cs...> - 2005-09-30 11:43:33
|
Omar=20 The problem is with statement =20 Singleton1 sing =3D Singleton1::getHandle(); =20 And =20 Singleton1 sing2 =3D Singleton1::getHandle(); =20 Here u are accepting the reference in an object so sing1 and sing2 are two different objects now the question arises how is it possible to create object when the constructor is private.Well the copy constructor does the trick ,so change the above given lines to =20 Singleton1 &sing =3D Singleton1::getHandle(); =20 Singleton1 &sing2 =3D Singleton1::getHandle(); =20 And for safety purpose define your copy constructor to be private. =20 Regards Neeraj ________________________________ From: dev...@li... [mailto:dev...@li...] On Behalf Of Omar Baqueiro Sent: Friday, September 30, 2005 4:54 PM To: dev...@li... Subject: [Dev-C++] Singleton with Reference? =20 Hello, I am trying to make a singleton class using a reference to an object, this is the code: ---- BEGIN main.cpp --- 01 #include <cstdio> 02 #include <iostream> 03 =20 04 /* 05 * Singleton class 06 */ 07 class Singleton1 08 { 09 int a,b,c; 10 =20 11 // class constructor 12 Singleton1(){} 13 public: =20 14 // class destructor 15 ~Singleton1(){} =20 16 static Singleton1 &getHandle() 17 { 18 static Singleton1 s; // create a static variable to preserve its value while the prgram is running 19 return s; 20 } 21 void setVars(int na, int nb, int nc) 22 { 23 a =3D na; 24 b =3D nb; 25 c =3D nc; 26 } 27 void printVars() 28 { 29 printf ("a: %d, b: %d, c: %d\n",a,b,c); 30 } 31 =20 32 }; 33 =20 34 using namespace std; 35 =20 36 int main(int argc, char *argv[]) 37 { 38 Singleton1 sing =3D Singleton1::getHandle(); 39 =20 40 puts("vars a,b,c have trash:"); 41 sing.printVars(); 42 =20 43 puts ("set vars to 1,2,3"); 44 sing.setVars(1,2,3); 45 =20 46 puts ("vars a,b,c should have 1,2,3, they have:"); 47 sing.printVars(); 48 =20 49 puts ("Getting Singleton1 handler again..."); 50 Singleton1 sing2 =3D Singleton1::getHandle(); 51 =20 52 puts("[using new handle] vars a,b,c should have 1,2,3, they have:"); 53 sing2.printVars(); 54 =20 55 system("PAUSE"); 56 return EXIT_SUCCESS; 57 } ---- EOF --- Now, the first lines until 49 on the main function behave as expected but, on line 50 I try to get again the handle to the singleton (via getHandle static function) but it returns another new variable so, the values (1,2 and 3 in this case) of the previous Singleton object are lost. Because of that line 53 will print 0,0,0 and not 1,2,3. Am I doing something wrong here?=20 Now, I can make it work if I change the getHandle function to return a pointer ( Singleton1 * getHandle() ) and I change also the static variable [line 18] to=20 18 static Singleton1 s =3D new Singleton1(); Of course I also change the references to the variable. But if I do it this way there is no way I can delete the dynamically allocated object. And I would like to do it using references and avoid pointers.=20 Any clue?=20 Cheers, Omar. --=20 Omar Baqueiro Espinosa Computer Systems Engineer Home: www.csc.liv.ac.uk/~omar/ Calendar: calendar.yahoo.com/obaqueiro=20 PGP Key available at: www.csc.liv.ac.uk/~omar/pgp.html _____ |
From: Omar B. <oba...@gm...> - 2005-09-30 11:41:33
|
Ok, sorry to reply myself but, after a bit of browsing aI have concluded that my exact problem is in the lines 38 and 50 (see complete code below) 38 Singleton1 sing =3D Singleton1::getHandle(); 50 Singleton1 sing2 =3D Singleton1::getHandle(); On these lines I was trying to get the handle to the actual object but instead the compiler calls the default "copy constructor" (the compiler makes is public by default): Singleton1(Singleton1 const&){} After I made this constructor private the complier throw me errors, so, if = I replace all the calls with a simple Singleton1.getHandle().getValues and .printValues everything goes allright. So my question now is, is there a way to achieve what I was trying to do in lines 38 and 50, this is to save in a variable the "handler" to the actual singleton variable ?? I know this is more a pure C++ issue [not a DevC++ specific issue) but and = I am sorry about that :) Cheers, Omar. On 9/30/05, Omar Baqueiro <oba...@gm...> wrote: > > Hello, I am trying to make a singleton class using a reference to an > object, this is the code: > > ---- BEGIN main.cpp --- > > 01 #include <cstdio> > 02 #include <iostream> > 03 > 04 /* > 05 * Singleton class > 06 */ > 07 class Singleton1 > 08 { > 09 int a,b,c; > 10 > 11 // class constructor > 12 Singleton1(){} > 13 public: > 14 // class destructor > 15 ~Singleton1(){} > 16 static Singleton1 &getHandle() > 17 { > 18 static Singleton1 s; // create a static variable to preserve its value > while the prgram is running > 19 return s; > 20 } > 21 void setVars(int na, int nb, int nc) > 22 { > 23 a =3D na; > 24 b =3D nb; > 25 c =3D nc; > 26 } > 27 void printVars() > 28 { > 29 printf ("a: %d, b: %d, c: %d\n",a,b,c); > 30 } > 31 > 32 }; > 33 > 34 using namespace std; > 35 > 36 int main(int argc, char *argv[]) > 37 { > 38 Singleton1 sing =3D Singleton1::getHandle(); > 39 > 40 puts("vars a,b,c have trash:"); > 41 sing.printVars(); > 42 > 43 puts ("set vars to 1,2,3"); > 44 sing.setVars(1,2,3); > 45 > 46 puts ("vars a,b,c should have 1,2,3, they have:"); > 47 sing.printVars(); > 48 > 49 puts ("Getting Singleton1 handler again..."); > 50 Singleton1 sing2 =3D Singleton1::getHandle(); > 51 > 52 puts("[using new handle] vars a,b,c should have 1,2,3, they have:"); > 53 sing2.printVars(); > 54 > 55 system("PAUSE"); > 56 return EXIT_SUCCESS; > 57 } > > ---- EOF --- > > Now, the first lines until 49 on the main function behave as expected but= , > on line 50 I try to get again the handle to the singleton (via getHandle > static function) but it returns another new variable so, the values (1,2 = and > 3 in this case) of the previous Singleton object are lost. Because of tha= t > line 53 will print 0,0,0 and not 1,2,3. > > Am I doing something wrong here? > > Now, I can make it work if I change the getHandle function to return a > pointer ( Singleton1 * getHandle() ) and I change also the static variabl= e > [line 18] to > > 18 static Singleton1 s =3D new Singleton1(); > > Of course I also change the references to the variable. But if I do it > this way there is no way I can delete the dynamically allocated object. A= nd > I would like to do it using references and avoid pointers. > > > Any clue? > > Cheers, > > Omar. > -- > Omar Baqueiro Espinosa > Computer Systems Engineer > Home: www.csc.liv.ac.uk/~omar/ <http://www.csc.liv.ac.uk/%7Eomar/> > Calendar: calendar.yahoo.com/obaqueiro > <http://calendar.yahoo.com/obaqueiro> > PGP Key available at: www.csc.liv.ac.uk/~omar/pgp.html<http://www.csc.liv= .ac.uk/%7Eomar/pgp.html> > _____ > -- Omar Baqueiro Espinosa Computer Systems Engineer Home: www.csc.liv.ac.uk/~omar/ <http://www.csc.liv.ac.uk/~omar/> Calendar: calendar.yahoo.com/obaqueiro <http://calendar.yahoo.com/obaqueiro= > PGP Key available at: www.csc.liv.ac.uk/~omar/pgp.html<http://www.csc.liv.ac.uk/~omar/pgp.html> _____ |
From: Omar B. <oba...@gm...> - 2005-09-30 11:24:28
|
Hello, I am trying to make a singleton class using a reference to an object= , this is the code: ---- BEGIN main.cpp --- 01 #include <cstdio> 02 #include <iostream> 03 04 /* 05 * Singleton class 06 */ 07 class Singleton1 08 { 09 int a,b,c; 10 11 // class constructor 12 Singleton1(){} 13 public: 14 // class destructor 15 ~Singleton1(){} 16 static Singleton1 &getHandle() 17 { 18 static Singleton1 s; // create a static variable to preserve its value while the prgram is running 19 return s; 20 } 21 void setVars(int na, int nb, int nc) 22 { 23 a =3D na; 24 b =3D nb; 25 c =3D nc; 26 } 27 void printVars() 28 { 29 printf ("a: %d, b: %d, c: %d\n",a,b,c); 30 } 31 32 }; 33 34 using namespace std; 35 36 int main(int argc, char *argv[]) 37 { 38 Singleton1 sing =3D Singleton1::getHandle(); 39 40 puts("vars a,b,c have trash:"); 41 sing.printVars(); 42 43 puts ("set vars to 1,2,3"); 44 sing.setVars(1,2,3); 45 46 puts ("vars a,b,c should have 1,2,3, they have:"); 47 sing.printVars(); 48 49 puts ("Getting Singleton1 handler again..."); 50 Singleton1 sing2 =3D Singleton1::getHandle(); 51 52 puts("[using new handle] vars a,b,c should have 1,2,3, they have:"); 53 sing2.printVars(); 54 55 system("PAUSE"); 56 return EXIT_SUCCESS; 57 } ---- EOF --- Now, the first lines until 49 on the main function behave as expected but, on line 50 I try to get again the handle to the singleton (via getHandle static function) but it returns another new variable so, the values (1,2 an= d 3 in this case) of the previous Singleton object are lost. Because of that line 53 will print 0,0,0 and not 1,2,3. Am I doing something wrong here? Now, I can make it work if I change the getHandle function to return a pointer ( Singleton1 * getHandle() ) and I change also the static variable [line 18] to 18 static Singleton1 s =3D new Singleton1(); Of course I also change the references to the variable. But if I do it this way there is no way I can delete the dynamically allocated object. And I would like to do it using references and avoid pointers. Any clue? Cheers, Omar. -- Omar Baqueiro Espinosa Computer Systems Engineer Home: www.csc.liv.ac.uk/~omar/ <http://www.csc.liv.ac.uk/~omar/> Calendar: calendar.yahoo.com/obaqueiro <http://calendar.yahoo.com/obaqueiro= > PGP Key available at: www.csc.liv.ac.uk/~omar/pgp.html<http://www.csc.liv.ac.uk/~omar/pgp.html> _____ |
From: lai l. <lai...@ya...> - 2005-09-30 11:14:06
|
hi, i am just beginner n still learning hard for the cpp. i have some problem here.. i once installed n used the dev-cpp 4.9.8.9 before, but because my pc's system corrupt, i formatted the hard disk. after that, i installed again, but problem happended. when i finished typing the code, the compiler cant run. the compiler show me a message : " unable to run program files ". problem still can not slove even though i uninstall n install again for many time. i search through all the system files. i deleted all the folder in application data, the program stil can not run.. pls help me to slove the problem, tks --------------------------------- Yahoo! for Good Click here to donate to the Hurricane Katrina relief effort. |
From: Alfred P. R. <al...@ya...> - 2005-09-30 01:33:51
|
Hi Noorez, See http://www.cppreference.com/stdstring/ isalpha, isdigit, etc. C++ I/O doesn't appear to have that capability. Noorez Kassam <lor...@ho...> wrote: When I am working with files, and I use the >> operator to input integers, how can i test to see that it is a 'valid' integer and not a character? And same with characters? Alfred P. Reaud |
From: Noorez K. <lor...@ho...> - 2005-09-29 22:49:14
|
When I am working with files, and I use the >> operator to input integers, how can i test to see that it is a 'valid' integer and not a character? And same with characters? _________________________________________________________________ Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. |
From: Lars L. <lh...@td...> - 2005-09-29 14:44:39
|
Hi I'm Trying to use DEV-C++ to compile and debug QT4 projects on an XP-platform I specify that thfe Qmake generated makefile Makefile.debug to be used, = QT defaults debug output to a ./debug directory when I try to run /debug the code it responds with "Warning: project not compiled" Is there a way out ?? =20 /Lars =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Lars Hostrup Larsen Gl=E6n=F8vej 90 4230 Sk=E6lsk=F8r Denmark =20 lh...@td... tel +45 58189909 / +45 51901320 =20 _____ =20 Jeg beskyttes af den gratis SPAMfighter til privatbrugere. Den har indtil videre sparet mig for at f=E5 5 spam-mails Betalende brugere f=E5r ikke denne besked i deres e-mails. Hent en gratis SPAMfighter her <http://www.spamfighter.com/Lang_DA/Product_Info.asp> .=20 |
From: Richard W. <rw...@fr...> - 2005-09-28 18:25:59
|
Please include me on your mailing list. |
From: Alfred P. R. <al...@ya...> - 2005-09-28 18:03:22
|
Hi Bhadram, Googling for this warning I found the followin at: http://www.codeproject.com/vcpp/stl/stl_without_warnings.asp "#pragma warning(disable: 4786) // identifier was truncated to 'number' characters in // the debug information // BUG: C4786 Warning Is Not Disabled with #pragma Warning // STATUS: Microsoft has confirmed this to be a bug in the Microsoft product. // This warning can be ignored. This occured only in the <map> container." bhadram rao <bha...@ya...> wrote: Dear friends, I'd a problem. I want to disable the warning 4786. I know that we can stop displaying it by writing # pragma warning(diable:4786) But the problem is that i have 4 cpp files and 3 header files. Then where to write this statement. I'd written in all the files. But it is giving the same warnings. How to solve this problem.Please help me in this aspect. Thanking you, yours sincerely, bhadram <snip> Alfred P. Reaud |
From: Alfred P. R. <al...@ya...> - 2005-09-28 17:51:51
|
Hi Dane, Provided that you allocated the variable in the form of, lets say: double **variable; variable = new double[256]; then the correct way to delete would be: delete [] variable; However if you used malloc, delete will not work. Try not to use malloc and free if possible in C++ code. If you did use malloc, delete is not the proper keyword, free would be the proper keyword. See http://www.cppreference.com/. Dane Ensign <da...@de...> wrote: Hi, Thank you in advance for any help you can offer. I am trying to delete an array of pointer to objects and its throwing an error, which I cant figure out how to solve. The message is: --Emp_app_C(1024) malloc: *** Deallocation of a pointer not malloced: 0xbffff9f4; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable ------MallocHelp to see tools to help debug First I build my array of pointers to objects: --employee* empList[MAX_EMPLOYEES]; After populating the array, I tried to delete it using these 2 different statements: 1. delete[] empList; 2. delete empList; Please can someone show me the correct statement that would delete this array properly? Best regards, Dane Ensign Alfred P. Reaud |
From: Michal M. <mi...@mo...> - 2005-09-28 17:44:58
|
Dane Ensign wrote: > employee* empList[MAX_EMPLOYEES]; for (int i=0; i<MAX_EMPLOYEES; i++) { delete empList[i]; } -- Regards, Michal ICQ# 175762750 |
From: Dane E. <da...@de...> - 2005-09-28 17:06:25
|
Hi, Thank you in advance for any help you can offer. I am trying to delete an array of pointer to objects and its throwing an error, which I cant figure out how to solve. The message is: --Emp_app_C(1024) malloc: *** Deallocation of a pointer not malloced: 0xbffff9f4; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable ------MallocHelp to see tools to help debug First I build my array of pointers to objects: --employee* empList[MAX_EMPLOYEES]; After populating the array, I tried to delete it using these 2 different statements: 1. delete[] empList; 2. delete empList; Please can someone show me the correct statement that would delete this array properly? Best regards, Dane Ensign |
From: bhadram r. <bha...@ya...> - 2005-09-28 14:22:16
|
Dear friends, I'd a problem. I want to disable the warning 4786. I know that we can stop displaying it by writing # pragma warning(diable:4786) But the problem is that i have 4 cpp files and 3 header files. Then where to write this statement. I'd written in all the files. But it is giving the same warnings. How to solve this problem.Please help me in this aspect. Thanking you, yours sincerely, bhadram --------------------------------- Yahoo! for Good Click here to donate to the Hurricane Katrina relief effort. |
From: Reid T. <rei...@at...> - 2005-09-28 03:37:26
|
Reid Thompson wrote: Sorry,, I hosed up the link for the download http://www.postgresql.org/ftp/binary/v8.0.3/win32/ |
From: Reid T. <jre...@ea...> - 2005-09-28 03:29:09
|
Terry Orgill wrote: > I am going to install dev-cpp and the mysql devpak on my laptop. I > have had problems getting mysql to work with dev-cpp in the past. > What version of mysql should I download? > none ;) Install PostgreSQL instead. The install using the windows installer takes only a couple of minutes. http://www.postgresql.org/ftp/binary/v8.0.3/win32/postgresql-8.0.3.zip http://www.postgresql.org/docs/8.0/interactive/libpq.html provides information on how to use the libpq library ( there are also libs for C++ and embedded sql, etc described). The below sample program works with Dev-Cpp(It's from the www.postgresql.org.docs site). Create a new project. Set the below as main.c. Add $POSTGRESQL_HOME/$VERSION/lib/libpq.a to Project/Project Options/Parameters/Add Library or Object. Add $POSTGRESQL_HOME/$VERSION/include to include directories. ( I also attacehd the Dev-Cpp .dev and Makefile.win and main.c files) The default connection and cursor will list info related to the default Postgresql db template, template1 and it's table pg_database. The commented out conninfo and DECLARE CURSOR lines assume you have created a DB called test and it contains a table called test_table. If you're unfamiliar with PostreSQL, the the included PGADMIN III is an intuitive interface. And the www.postgresql.org.docs site has very good documentation. /* * testlibpq.c * * Test the C version of LIBPQ, the POSTGRES frontend library. */ #include <stdio.h> #include <stdlib.h> #include "libpq-fe.h" static void exit_nicely(PGconn *conn) { PQfinish(conn); system("PAUSE");/* I added this for Dev-CPP */ exit(1); } int main(int argc, char **argv) { const char *conninfo; PGconn *conn; PGresult *res; int nFields; int i, j; /* * If the user supplies a parameter on the command line, use it as * the conninfo string; otherwise default to setting dbname=template1 * and using environment variables or defaults for all other connection * parameters. */ if (argc > 1) conninfo = argv[1]; else conninfo = "hostaddr = 127.0.0.1 dbname = template1 user = postgres password = postgres"; //conninfo = "hostaddr = 127.0.0.1 dbname = test user = postgres password = postgres"; /* Make a connection to the database */ conn = PQconnectdb(conninfo); /* Check to see that the backend connection was successfully made */ if (PQstatus(conn) != CONNECTION_OK) { fprintf(stderr, "Connection to database failed: %s", PQerrorMessage(conn)); exit_nicely(conn); } /* * Our test case here involves using a cursor, for which we must be * inside a transaction block. We could do the whole thing with a * single PQexec() of "select * from pg_database", but that's too * trivial to make a good example. */ /* Start a transaction block */ res = PQexec(conn, "BEGIN"); if (PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr, "BEGIN command failed: %s", PQerrorMessage(conn)); PQclear(res); exit_nicely(conn); } /* * Should PQclear PGresult whenever it is no longer needed to avoid * memory leaks */ PQclear(res); /* * Fetch rows from pg_database, the system catalog of databases */ res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from pg_database"); //res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from test_table"); if (PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr, "DECLARE CURSOR failed: %s", PQerrorMessage(conn)); PQclear(res); exit_nicely(conn); } PQclear(res); res = PQexec(conn, "FETCH ALL in myportal"); if (PQresultStatus(res) != PGRES_TUPLES_OK) { fprintf(stderr, "FETCH ALL failed: %s", PQerrorMessage(conn)); PQclear(res); exit_nicely(conn); } /* first, print out the attribute names */ nFields = PQnfields(res); for (i = 0; i < nFields; i++) printf("%-15s", PQfname(res, i)); printf("\n\n"); /* next, print out the rows */ for (i = 0; i < PQntuples(res); i++) { for (j = 0; j < nFields; j++) printf("%-15s", PQgetvalue(res, i, j)); printf("\n"); } PQclear(res); /* close the portal ... we don't bother to check for errors ... */ res = PQexec(conn, "CLOSE myportal"); PQclear(res); /* end the transaction */ res = PQexec(conn, "END"); PQclear(res); /* close the connection to the database and cleanup */ PQfinish(conn); system("PAUSE"); /* I added this for Dev-CPP */ return 0; } |
From: <jua...@ug...> - 2005-09-27 19:46:51
|
Hello, you can try this link but is in spanisk: http://c.conclase.net/mysql/index.php ----- Original Message -----=20 From: Terry Orgill=20 To: dev...@li...=20 Sent: Tuesday, September 27, 2005 8:23 PM Subject: [Dev-C++] mysql I am going to install dev-cpp and the mysql devpak on my laptop. I = have had problems getting mysql to work with dev-cpp in the past. What = version of mysql should I download? |
From: Terry O. <te...@st...> - 2005-09-27 18:22:01
|
I am going to install dev-cpp and the mysql devpak on my laptop. I have had problems getting mysql to work with dev-cpp in the past. What version of mysql should I download? |
From: Per W. <pw...@ia...> - 2005-09-26 21:46:25
|
Is "d:\source\Makefile.win" the real path, or does "\source\" represent a path with space in? Unix tools (gcc etc. are ports of unix tools) does not like spaces in paths unless they have been enclosed in quotation marks. /Per W On Mon, 26 Sep 2005, Omar Baqueiro wrote: > Hello I am trying to compile the G3D library ( > http://g3d-cpp.sourceforge.net/html/guideinstall.html) > I downloaded the sourcecode from the CVS and opened the .dev project file, > after that I add the library and include paths (as specified on the > installer) and everything goes okey. > > Once I try to compile (Execute/Rebuild All menu) i get the following error: > > Could not create makefile "D:\source\Makefile.win" > IO error 32 |
From: Omar B. <oba...@gm...> - 2005-09-26 17:52:51
|
Hello I am trying to compile the G3D library ( http://g3d-cpp.sourceforge.net/html/guideinstall.html) I downloaded the sourcecode from the CVS and opened the .dev project file, after that I add the library and include paths (as specified on the installer) and everything goes okey. Once I try to compile (Execute/Rebuild All menu) i get the following error: Could not create makefile "D:\source\Makefile.win" IO error 32 I am using mingw compiler, and I CAN compile any other project, I go to the stated directory and I SEE a Makefile.win file (although, if DevC++ is stil= l running I CAN NOT open it). After I close devc++ i open the file and it is empty, I delete it and try again without luck... Does anyone knows if I am doing something wrong? has anybody compiled or used G3D? does anyone know where can I get the devc++/mingw precompiled lib= s (as I can not compile it, and according to the G3D home page the only way t= o get them is to compile by hand). Cheers, Omar. -- Omar Baqueiro Espinosa Computer Systems Engineer Home: www.csc.liv.ac.uk/~omar/ <http://www.csc.liv.ac.uk/~omar/> Calendar: calendar.yahoo.com/obaqueiro <http://calendar.yahoo.com/obaqueiro= > PGP Key available at: www.csc.liv.ac.uk/~omar/pgp.html<http://www.csc.liv.ac.uk/~omar/pgp.html> _____ |
From: Per W. <pw...@ia...> - 2005-09-25 21:17:26
|
You should use std::istream and std::ostream Google a bit about namespaces in C++. /Per W On Sun, 25 Sep 2005, Andrei R. Thomaz wrote: > hello list, > > I am trying to overload the operators << and >> to save and read a > class I am coding, called Preenchimento, but I am having some problems. > When I try to compile the file, I get these errors: > > in file included from preenchimento.cpp:15: > preenchimento.h:33: error: expected constructor, destructor, or type > conversion before '&' token > preenchimento.h:33: error: expected `,' or `;' before '&' token |
From: Bruno G. <bgu...@co...> - 2005-09-25 20:45:38
|
Hello! Has anyone used Dev-C++ in connection with the graphics package dislin = (www.dislin.de) ? I usually use the Dev-C++ environment in the Console = Application mode (I really know nothing about the Windows Application = mode) and I know how to output numerical calculations to a file. = However, with help, I was able to use Dislin to output mathematical = graphs and this has to be used in the Windows Application environment = with none of the complicated coding seen when you start a new Windows = Application project (under Dev-C++). So, what I am interested in is being able to use the best of both world = within the Windows Application environment, so that I can see a) raw = numerical data on the screen, b) output it to a file, c) view = mathematical graphs on the screen, d) output mathematical graphs to a = file. I know how to do a) and b) together but I have to be in Console Mode and = I know how to do c) and d) together but I have to be in Windows = Application mode. I would like to do a),b),c)d) in Windows Application = mode. I do not think it will be possible to do it in Console = Application mode. If you are able to gauge the situation, let me know and I can send you = two very simple files, one doing a),b) and the other one doing c),d). = Then perhaps you could give me some guidance on how to "put" everything = together. Sincerely, Bruno |
From: Andrei R. T. <and...@gm...> - 2005-09-25 20:43:36
|
hello list, I am trying to overload the operators << and >> to save and read a class I am coding, called Preenchimento, but I am having some problems. When I try to compile the file, I get these errors: in file included from preenchimento.cpp:15: preenchimento.h:33: error: expected constructor, destructor, or type conversion before '&' token preenchimento.h:33: error: expected `,' or `;' before '&' token preenchimento.h:34: error: expected constructor, destructor, or type conversion before '&' token preenchimento.h:34: error: expected `,' or `;' before '&' token preenchimento.cpp:61: error: expected constructor, destructor, or type conversion before '&' token preenchimento.cpp:61: error: expected `,' or `;' before '&' token preenchimento.cpp:71: error: expected constructor, destructor, or type conversion before '&' token preenchimento.cpp:71: error: expected `,' or `;' before '&' token the code from preenchimento.h class Preenchimento { public: unsigned char red, green, blue; unsigned int alpha; public: Preenchimento(); Preenchimento(unsigned int r, unsigned int g, unsigned int b, unsigned int a); ~Preenchimento(); int CriaPreenchimento(unsigned int r, unsigned int g, unsigned int b, unsigned int a); void ativa(); const Preenchimento& operator=(const Preenchimento&); }; istream& operator >>(istream&, Preenchimento&); ostream& operator <<(ostream&, const Preenchimento&); the header of preenchimento.cpp #include <windows.h> #include <gl/gl.h> #include <iostream> #include "preenchimento.h" Preenchimento::Preenchimento() { red = green = blue = 0; alpha = 0; } thank you for your time, andrei -- RGB Design Digital www.rgbdesigndigital.com.br an...@rg... / (51) 92067436 |
From: Jonathan D. <gri...@ho...> - 2005-09-24 21:41:40
|
Hey, I noticed the same behavior with other features of Dev-C++. One in particular is the ability to Ctrl-click a function to goto its definition. If the function definition is moved and the source file is not reparsed by Dev-C++ (by reloading the project or otherwise), the Ctrl-click will return to the original line that the definition was on. This can get annoying when making new functions and taking the ctrl-click feature for granted. It won't goto a new function. It's all probably not a bug, but it is definitely not user-friendly. _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |
From: Alfred P. R. <al...@ya...> - 2005-09-24 17:22:09
|
Hi Andreas, It may help to use the wxWidgets version of Dev-C++ at http://wxdsgn.sourceforge.net/ wxWidgets is integrated into this version of Dev-C++. Uninstall the standard version of Dev-C++ of course. Andreas Moroder <and...@gm...> wrote: Hello, I would like to use dev-c++ togheter with wxwidgtes. Following the instructions from http://www.wxwindows.org/devcpp.htm#links I installed the latest versions of Imagelib and wxwindows devpak. If I create a new wxWidgets GUI project and compile it I get many errors regarding tpyes already defined. Now I restarted dev-g++ and now I get error messages that the compiler does no more find the wx/wx.h include file <snip> Alfred P. Reaud |
From: Andreas M. <and...@gm...> - 2005-09-24 17:11:26
|
Hello, I would like to use dev-c++ togheter with wxwidgtes. Following the instructions from http://www.wxwindows.org/devcpp.htm#links I installed the latest versions of Imagelib and wxwindows devpak. If I create a new wxWidgets GUI project and compile it I get many errors regarding tpyes already defined. Now I restarted dev-g++ and now I get error messages that the compiler does no more find the wx/wx.h include file Please help Bye Andreas |