dev-cpp-users Mailing List for Dev-C++ (Page 52)
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: Adam J. <aj...@i-...> - 2007-08-24 14:07:47
|
There are some other items that I would be concerned with in your code. Maybe because this is a test is why you did what you did. Here are some comments about what you are trying to do. I believe the explanation you got from the others explain what is happening. It also appears that You are trying to mix two styles (C style programming with C++ Style programming). My advice is to pick one. You mix C headers with C++ header files, some of which overlap functionality. > #include <cstdlib> <== This is a C++ implementation of the C stdlib > #include <iostream> <== This is a C++ io implementation header > #include <stdio.h> <== This is a C io implementation header > #include <conio.h> <== This is a C Style console io implementation file that is not support by all compilers on different OSes As you can see you have three different io implementations, and what makes it worse is that you only use the functionality in iostream. The other io headers aren't used in your code. My suggestion is only include the header files you need. > pa = (bartek*) x; The cast listed above is a C Style cast not a C++ cast (Mixing Styles...). C++ uses static_cast, dynamic_cast, etc. Be careful when you do cast. You can get yourself in a lot of trouble. Just because the compiler doesn't complain, doesn't mean your program will run correctly. You are mixing two types that don't really go together nicely. Your user defined abstract data type (bartek) and the native int type. > Per Wrote: > Never play with pointers. Only convert between compatible pointers. He is exactly right. I would expand on this by saying types instead of pointers. But the idea is the same. As you found out this utimately was part of your problem. The assumetions you made about how the casting would be implemented. One final point, if you are going to ceate your own types and manupilate them, don't try and reinvent the wheel. C++ has the STL, part of the STL is containers and iterators. If you create your abstract types to conform to the STL, it will make your life a lot easier. You should use the STL containers, iterators, and algorithms as much as you can. They are time tested and very efficient at what they do. -Adam Jones -i-softwareproducts.com |
From: Per W. <pw...@ia...> - 2007-08-24 12:03:38
|
6c6c6cMany errors. The 6th element of an array is not array[6] but array[5]. The first element is array[0], not array[1]. In this case, your pointer usage is wrong. An int pointer may be used with the address of an integer. x is an array of integers, and the language does not promise any guaranteed behaviour if you use a type cast to assign a pointer of a different type with the array, and then try to use this pointer to try to reach around. If we ASSUME that the struct is laid out as three integers, where the middle integer is 4 charactesr, and the integers are 4 bytes large and that the struct totals 12 bytes etc, etc then you would get: (pa+2) would be the same as pa[2] and be 2*12 =3D 24 bytes forward in the int array. 24 bytes - given 4-byte integers - would mean that the pointer jumps over 6 integers. So, it will access the 7th integer (x[6]) which has the value 6. Just as expected if all assumptions was correct. But the code would still be wrong. A change of the memory layout of the struct - which the compiler is allowed to do - or a change of the integer size - depending on architecture - would make your code to either crash or to emit completely different values. Never play with pointers. Only convert between compatible pointers. an int pointer may be set to point at the a member of a bartek struct. But may not be used to access anything but that specific a element. A bartek pointer may never be used to point to an integer. A type cast will make the compiler happy, but your code would break the assumptions allowed by the language standard. /pwm On Fri, 24 Aug 2007, [UTF-8] Bartosz =C5=9Aliwa wrote: > Hi. > > Could you tell me, why pointer 'pa' shows 6 element of the table (x[6]). = Why it does not show second element? Here is the code: > > #include <cstdlib> > #include <iostream> > #include <stdio.h> > #include <conio.h> > > > > using namespace std; > > struct bartek { > int a; > char c[4]; > int b; > } *wsk1_bartek; > > int x[1000]; > > int main(int argc, char *argv[]) > { > system("PAUSE"); > > bartek *pa; > > pa =3D (bartek*) x; > > for(int i =3D 0 ; i < 100; ++i) { > x[i] =3D i; > } > > cout <<" After shift +2: " << (pa+2)->a << endl; > > cout <<" Global object read on 6 position x[6]: " << x[6] > << endl; > > system("PAUSE"); > > return EXIT_SUCCESS; > > } > > > ...and here is the output: > > Press any key to continue... > After shift +2: 6 > Global object on 6 position x[6]: 6 > Press any key to continue... > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Siva C. <siv...@ya...> - 2007-08-24 11:54:56
|
Hi, First let me make a few notes which will help understand your code better. I am assuming that you are working on a 32 bit system. 1. pa is a pointer of type bartek. 2. The size of the bartek datatype is 12 bytes. It is not 9 bytes since the size in bytes should be a multiple of 4 in a 32 bit system. 3. Since size of bartek is 12 bytes, pa+2 will point to a location which is 24 bytes ahead of the location pointed by pa. 4. The size of int is 4 bytes. With the above points in mind, pa+2 points to a location which is 24/4=6 int locations away from pa. Which is to say that pa+2 points to the 7th integer in the array x. The 7th integer in the array is x[6]. Hope I could clear your confusion. /Siva Chandra --- Bartosz Åliwa <ba...@o2...> wrote: > Hi. > > Could you tell me, why pointer 'pa' shows 6 element > of the table (x[6]). Why it does not show second > element? Here is the code: > > #include <cstdlib> > #include <iostream> > #include <stdio.h> > #include <conio.h> > > > > using namespace std; > > struct bartek { > int a; > char c[4]; > int b; > } *wsk1_bartek; > > int x[1000]; > > int main(int argc, char *argv[]) > { > system("PAUSE"); > > bartek *pa; > > pa = (bartek*) x; > > for(int i = 0 ; i < 100; ++i) { > x[i] = i; > } > > cout <<" After shift +2: " << (pa+2)->a << endl; > > cout <<" Global object read on 6 position x[6]: " << > x[6] > << endl; > > system("PAUSE"); > > return EXIT_SUCCESS; > > } > > > ...and here is the output: > > Press any key to continue... > After shift +2: 6 > Global object on 6 position x[6]: 6 > Press any key to continue... > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? > Stop. > Now Search log events and configuration files using > AJAX and a browser. > Download your FREE copy of Splunk now >> > http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: > http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > ____________________________________________________________________________________ Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. http://tv.yahoo.com/collections/222 |
From: <ba...@o2...> - 2007-08-24 11:05:37
|
Hi. Could=20you=20tell=20me,=20why=20pointer=20'pa'=20shows=206=20element=20o= f=20the=20table=20(x[6]).=20Why=20it=20does=20not=20show=20second=20eleme= nt?=20Here=20is=20the=20code: #include=20<cstdlib> #include=20<iostream> #include=20<stdio.h> #include=20<conio.h> using=20namespace=20std; struct=20bartek=20{ =20=20=20=20=20=20=20=20=20int=20a; =20=20=20=20=20=20=20=20=20char=20c[4]; =20=20=20=20=20=20=20=20=20int=20b; }=20*wsk1=5Fbartek; int=20x[1000]; int=20main(int=20argc,=20char=20*argv[]) { =20=20=20=20system("PAUSE"); =20=20 =20=20=20=20bartek=20*pa; =20=20=20=20 =20=20=20=20pa=20=3D=20(bartek*)=20x; =20=20=20=20 =20=20=20=20for(int=20i=20=3D=200=20;=20i=20<=20100;=20++i)=20=20=20{ =20=20=20=20=20=20=20=20=20=20=20=20x[i]=20=3D=20i; =20=20=20=20} =20=20=20=20 cout=20<<"=20After=20shift=20+2:=20"=20<<=20(pa+2)->a=20<<=20endl; =20=20=20=20 cout=20<<"=20Global=20object=20read=20on=206=20position=20x[6]:=20"=20<<=20= x[6] <<=20endl; =20 =20=20=20=20system("PAUSE"); =20=20=20=20return=20EXIT=5FSUCCESS; } ...and=20here=20is=20the=20output: Press=20any=20key=20to=20continue... After=20shift=20+2:=206 Global=20object=20on=206=20position=20x[6]:=206 Press=20any=20key=20to=20continue... |
From: Duong Ha N. <nha...@gm...> - 2007-08-22 01:23:14
|
Hi, I used to write code like that to pause my program to see the result or debug, #include <stdio.h> int main() { printf("Hello World\n"); scanf("\n"); // <-- Add this line only return 0; } To make it continue to run again I just type any character and press "Enter". Good luck. 2007/8/22, Adam Jones <aj...@i-...>: > > The flash you see is the win console window opening and closing. You have > to > stop or pause the program execution to see the output. You can do it as > others have said: > > >> Try using a DOS prompt to execute the same file and see what happens. > > Or you can use a system call to pause the execution. See your updated code > below: > > #include <stdio.h> > #include <stdlib.h> //<== Add this line to your code > > int main() > { > printf("Hello World\n"); > > system("pause"); //<== Add this line to your code > return 0; > } > > Please no lectures on the evils of system("pause"). We have been thru that > on this list before... Warning: don't use system("pause") in production > code..... > > -Adam Jones > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Adam J. <aj...@i-...> - 2007-08-22 00:34:31
|
The flash you see is the win console window opening and closing. You have to stop or pause the program execution to see the output. You can do it as others have said: >> Try using a DOS prompt to execute the same file and see what happens. Or you can use a system call to pause the execution. See your updated code below: #include <stdio.h> #include <stdlib.h> //<== Add this line to your code int main() { printf("Hello World\n"); system("pause"); //<== Add this line to your code return 0; } Please no lectures on the evils of system("pause"). We have been thru that on this list before... Warning: don't use system("pause") in production code..... -Adam Jones |
From: Chris M. <lor...@gm...> - 2007-08-21 23:14:32
|
On 8/21/07, Daniel Tihonov <pra...@ho...> wrote: > > hi, i have a problem with the dev c++ program > When i compile and run my program, the run window flashes for less then a > second and shuts off Yup. That's exactly what you told it to do (whether you realize it or not!) > Other people are saying that they dont have such a problem > is this supposed to be like this? Those others are probably those who've tweaked their settings. Try using a DOS prompt to execute the same file and see what happens. ;^) > the code i ran: > #include <stdio.h> > int main() > { > printf("Hello World\n"); > return 0; > } > > (straight from your tutorial) > > ________________________________ > Connect to the next generation of MSN Messenger Get it now! > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: > http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users Yes, Lord Sauron is back! |
From: Daniel T. <pra...@ho...> - 2007-08-21 22:35:27
|
hi, i have a problem with the dev c++ program When i compile and run my program, the run window flashes for less then a s= econd and shuts off Other people are saying that they dont have such a problem is this supposed to be like this? the code i ran:=20 #include <stdio.h>int main(){ printf("Hello World\n"); return 0;} (straight from your tutorial) _________________________________________________________________ Connect to the next generation of MSN Messenger=A0 http://imagine-msn.com/messenger/launch80/default.aspx?locale=3Den-us&sourc= e=3Dwlmailtagline= |
From: Adam J. <aj...@i-...> - 2007-08-21 12:14:47
|
No problem, I am glad I could help. -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Lloyd Sent: Monday, August 20, 2007 10:03 AM To: dev...@li... Subject: Re: [Dev-C++] regex librry Thank you Adam, I have just started to look in it. Regards, Lloyd On Mon, 2007-08-20 at 08:48 -0400, Adam Jones wrote: > >>You wrote: > >>Hi, > >> Would anybody suggest me a regular expression pattern matching library? > >>It must be capable of searching in binary files as well.... > > You can try boost. I don't know if it does binary, but you can check it out > at this link: > > http://www.boost.org/libs/regex/doc/index.html > > I do like the boost library, and I use it every chance I get. Especially > because some items from boost will become part of TR1 the next C++ > specification. > > -Adam Jones > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ______________________________________ Scanned and protected by Email scanner ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Adam J. <aj...@i-...> - 2007-08-20 16:43:25
|
>>You wrote: >> If i have a declaration like the following >>int **temp; >>we want to create an array of integer pointers of dimension 1 x n and memory must be allocated dynamically. Hmmmm.. I don't know why you would use a pointer to pointers to represent a dynamically allocated 2 dimensional array in C++. This appears that you are using a C-Style implementation. The data structure you are trying to create appears to be a matrix. There are several ways to accomplish this. I will take the C++ route, and use a class with vectors to implement a matrix data structure. That would be the C++ straight forward approach. Within this class you could use templates so you could create a matrix with any C++ native types and not just integers. If you didn't want to do it by hand, the Boost library which I have recommended to a lot of people on this list has it already done it for you. Check out this link: http://www.boost.org/libs/numeric/ublas/doc/matrix.htm -Adam Jones |
From: Lloyd <ll...@cd...> - 2007-08-20 13:55:21
|
Thank you Adam, I have just started to look in it. Regards, Lloyd On Mon, 2007-08-20 at 08:48 -0400, Adam Jones wrote: > >>You wrote: > >>Hi, > >> Would anybody suggest me a regular expression pattern matching library? > >>It must be capable of searching in binary files as well.... > > You can try boost. I don't know if it does binary, but you can check it out > at this link: > > http://www.boost.org/libs/regex/doc/index.html > > I do like the boost library, and I use it every chance I get. Especially > because some items from boost will become part of TR1 the next C++ > specification. > > -Adam Jones > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ______________________________________ Scanned and protected by Email scanner |
From: Muhammad A. <amm...@ho...> - 2007-08-20 12:51:21
|
Hello everyone.Hope everyone will be good and fine.If i have a declaration = like the followingint **temp;we want to create an array of integer pointers= of dimension 1 x n and memory must be allocated dynamically.Best RegardsMu= hammad Ammar _________________________________________________________________ Messenger Caf=E9 =97 open for fun 24/7. Hot games, cool activities served d= aily. Visit now. http://cafemessenger.com?ocid=3DTXT_TAGLM_AugWLtagline= |
From: Adam J. <aj...@i-...> - 2007-08-20 12:50:56
|
No problem. I am glad I could help. =20 -Adam Jones =20 From: dev...@li... [mailto:dev...@li...] On Behalf Of marco antonio licea flores Sent: Saturday, August 18, 2007 7:15 PM To: dev...@li... Subject: [Dev-C++] Rv: Re: Request information =20 Adams: =20 Thanks a lot for your information. =20 Best regards to everybody. =20 Sincerely =20 Marco Licea =20 Nota: Se adjunt=F3 el mensaje reenviado. =20 _____ =20 =A1S=E9 un mejor fot=F3grafo! Perfecciona tu t=E9cnica y encuentra las mejores fotos en: http://mx.yahoo.com/promos/mejorambientalista.html |
From: Adam J. <aj...@i-...> - 2007-08-20 12:48:48
|
>>You wrote: >>Hi, >> Would anybody suggest me a regular expression pattern matching library? >>It must be capable of searching in binary files as well.... You can try boost. I don't know if it does binary, but you can check it out at this link: http://www.boost.org/libs/regex/doc/index.html I do like the boost library, and I use it every chance I get. Especially because some items from boost will become part of TR1 the next C++ specification. -Adam Jones |
From: Lloyd <ll...@cd...> - 2007-08-19 10:20:11
|
Hi, Would anybody suggest me a regular expression pattern matching library? It must be capable of searching in binary files as well.... Thank you very much, Lloyd ______________________________________ Scanned and protected by Email scanner |
From: matheus r. <mfr...@gm...> - 2007-08-18 15:49:55
|
> jme::Combo::Combo(const Glib::ustring& title){ > Glib::ustring* ustr; > std::auto_ptr<Glib::ustring> ustr(new Glib::ustring("Unknown")); > if(!title.empty()) { > this->ustr->assign(title); > } > } > Thanks in advance! My guess is that ustr is both a local variable and a member variable with the same name. In the example above, you assigned the new glib string to the local variable but used assign on the member below, which was probably not initialized. If both are auto_ptr, I guess what you wanted to do is: ustr.reset(new Glib::ustring("Unknown")); instead of std::auto_ptr<Glib::ustring> ustr(new Glib::ustring("Unknown")); |
From: Jamiil A. <jal...@gm...> - 2007-08-18 14:28:28
|
Sorry, for being so lazy and not post a more elaborate question, I hope this would be a better way to ask this question. jme::Combo::Combo(const Glib::ustring& title){ Glib::ustring* ustr; std::auto_ptr<Glib::ustring> ustr(new Glib::ustring("Unknown")); if(!title.empty()) { this->ustr->assign(title); } } Thanks in advance! ----- Original Message ----- From: "Reid Thompson" <rei...@at...> To: "Jamiil Abduqadir" <jal...@gm...> Cc: "'Dev Cpp MailingLinst'" <dev...@li...> Sent: Friday, August 17, 2007 5:33 PM Subject: Re: [Dev-C++] Glib::ustring::assign(...) > Jamiil Abduqadir wrote: >> std::auto_ptr<Glib::ustring> ustr(new Glib::ustring("Unknown")); >> if(!title.empty()) >> { >> this->ustr->assign(title); // Segmentation Fault <<===== >> } >> Be my guest. > what's the definition of ustr???? > > > does this example work on your system? > > http://wwwasd.web.cern.ch/wwwasd/lhc++/RW/stdlibcr/aut_3512.htm > > // > // auto_ptr.cpp > // > #include <iostream.h> > #include <memory> > // > // A simple structure. > // > struct X > { > X (int i = 0) : m_i(i) { } > int get() const { return m_i; } > int m_i; > }; > int main () > { > // > // b will hold a pointer to an X. > // > auto_ptr<X> b(new X(12345)); > // > // a will now be the owner of the underlying pointer. > // > auto_ptr<X> a = b; > // > // Output the value contained by the underlying pointer. > // > cout << a->get() << endl; > // > // The pointer will be deleted when a is destroyed on > // leaving scope. > // > return 0; > } > Output : > 12345 |
From: Reid T. <rei...@at...> - 2007-08-18 00:31:04
|
Jamiil Abduqadir wrote: > std::auto_ptr<Glib::ustring> ustr(new Glib::ustring("Unknown")); > if(!title.empty()) > { > this->ustr->assign(title); // Segmentation Fault <<===== > } > > Be my guest. what's the definition of ustr???? does this example work on your system? http://wwwasd.web.cern.ch/wwwasd/lhc++/RW/stdlibcr/aut_3512.htm // // auto_ptr.cpp // #include <iostream.h> #include <memory> // // A simple structure. // struct X { X (int i = 0) : m_i(i) { } int get() const { return m_i; } int m_i; }; int main () { // // b will hold a pointer to an X. // auto_ptr<X> b(new X(12345)); // // a will now be the owner of the underlying pointer. // auto_ptr<X> a = b; // // Output the value contained by the underlying pointer. // cout << a->get() << endl; // // The pointer will be deleted when a is destroyed on // leaving scope. // return 0; } Output : 12345 |
From: Jamiil A. <jal...@gm...> - 2007-08-17 23:41:52
|
std::auto_ptr<Glib::ustring> ustr(new Glib::ustring("Unknown")); if(!title.empty()) { this->ustr->assign(title); // Segmentation Fault = <<=3D=3D=3D=3D=3D } Be my guest. ----- Original Message -----=20 From: Adam Jones=20 To: 'Dev Cpp MailingLinst'=20 Sent: Friday, August 17, 2007 11:13 AM Subject: Re: [Dev-C++] Glib::ustring::assign(...) If you are getting a Segmentation fault on this->ustr->assign(title); =20 My guess would be that this-> or ustr-> pointer is not defined. = Usually segmentation faults points to pointer allocation problems. I = would check these pointers to make sure they are defined, by the time = you try to use them. =20 -Adam Jones =20 From: dev...@li... = [mailto:dev...@li...] On Behalf Of Jamiil = Abduqadir Sent: Friday, August 17, 2007 1:40 AM To: Dev Cpp MailingLinst; gtk...@gn... Subject: [Dev-C++] Glib::ustring::assign(...) =20 WinXP GNU 3.4.2 I have this statement in=20 if(!title.empty()) { this->ustr->assign(title); // Segmentation Fault } Now, dbg reports that: #0 0x6650d384 std::string::assign(std::string const&) (??:??) #1 0x664d9c69 Glib::ustring::assign(Glib::ustring const&) = (/usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/bits/basic_string.h:427) #2 0x00401e83 jme::Combo::Combo(Glib::ustring const&) (??:??) #3 0x004027ea jme::NameFrame::Init() (??:??) #4 0x00402c54 jme::NameFrame::NameFrame() (??:??) #5 0x0040649c jme::Contacts::Contacts() (??:??) #6 0x00409f1d jme::Jaime::Init() (??:??) #7 0x004097e0 jme::Jaime::Jaime() (??:??) #8 0x0042068e main (??:??) =20 Does anyone know what this error mean and/or what I can do to get rid = of the error? =20 =20 T.I.A. -------------------------------------------------------------------------= ----- = -------------------------------------------------------------------------= This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a = browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ -------------------------------------------------------------------------= ----- _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Adam J. <aj...@i-...> - 2007-08-17 20:24:52
|
>> You Wrote: >> Can any one tell me is there any way to convert char* to wchar* . You can do it this way. I would be very hesitant to do it like this. Because of the character set that is being used may not convert correctly to the anscii character set. pwideChar = reinterpret_cast<wchar_t *> (pChar); Is there a reason you are not using wstring instead of wchar_t*? In C++ it is a good habit to work with strings instead of the C style char * or wchar_t *. You can also easily convert to a char* from a string if you need to. -Adam Jones |
From: Adam J. <aj...@i-...> - 2007-08-17 18:21:34
|
>>You Wrote: >> Can someone tell me ? What are the library name (or standar package = name for Dev-C++) for trying to access and update the Data Base ( SQL Server 2000) ? =20 There are a number of ways to connect to MS SQL Server. There are = packages like libdbi, FreeTDS, etc=85 =20 You can also just connect to MS SQL Server by using libodbc32. If you = choose that route, you will need to include windows.h, sql.h, and sqlext.h. =20 -Adam Jones =20 From: dev...@li... [mailto:dev...@li...] On Behalf Of marco antonio licea flores Sent: Thursday, August 16, 2007 6:41 PM To: dev...@li... Subject: [Dev-C++] Request information =20 Hi... =20 Can someone tell me ? What are the library name (or standar package name = for Dev-C++) for trying to access and update the Data Base ( SQL Server = 2000) ? =20 Thanks a lot for your information. =20 Best regards =20 Marco Licea=20 =20 _____ =20 =A1S=E9 un mejor ambientalista! Encuentra consejos para cuidar el lugar donde vivimos en: http://mx.yahoo.com/promos/mejorambientalista.html |
From: Adam J. <aj...@i-...> - 2007-08-17 18:13:15
|
If you are getting a Segmentation fault on this->ustr->assign(title); My guess would be that this-> or ustr-> pointer is not defined. Usually segmentation faults points to pointer allocation problems. I would check these pointers to make sure they are defined, by the time you try to use them. -Adam Jones From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Friday, August 17, 2007 1:40 AM To: Dev Cpp MailingLinst; gtk...@gn... Subject: [Dev-C++] Glib::ustring::assign(...) WinXP GNU 3.4.2 I have this statement in if(!title.empty()) { this->ustr->assign(title); // Segmentation Fault } Now, dbg reports that: #0 0x6650d384 std::string::assign(std::string const&) (??:??) #1 0x664d9c69 Glib::ustring::assign(Glib::ustring const&) (/usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/bits/basic_string.h:427) #2 0x00401e83 jme::Combo::Combo(Glib::ustring const&) (??:??) #3 0x004027ea jme::NameFrame::Init() (??:??) #4 0x00402c54 jme::NameFrame::NameFrame() (??:??) #5 0x0040649c jme::Contacts::Contacts() (??:??) #6 0x00409f1d jme::Jaime::Init() (??:??) #7 0x004097e0 jme::Jaime::Jaime() (??:??) #8 0x0042068e main (??:??) Does anyone know what this error mean and/or what I can do to get rid of the error? T.I.A. |
From: Adam J. <aj...@i-...> - 2007-08-17 18:08:40
|
>>You wrote: >>Can anyone tell me how to create objects (of a particular class) without >>hard coding them? I want the program to prompt me to input a string of >>characters then make an object of that name. I have thought of using cin >>but I am still unsuccessful. Thanks for your time. Class names can't be a parameter. Classes are created when the socurce code is built. The compiler needs to know the name of the class. You can't use a variable name as a class. class foobar { ....... .... } foobar can't be a variable. It has to be a name. You also can't create foobar and then assign it to some unknown vairable until runtime. Classes and objects all have to be defined in the source code. The syntax to create a new object of some type is typename pointer_name = new typename. No variables allowed. If I am wrong on this I would should like to see some working code.......but I don't think I am. :) -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Tan, Clarencio Sent: Friday, August 17, 2007 3:59 AM To: dev...@li... Subject: [Dev-C++] Creating objects Hi Guys, Can anyone tell me how to create objects (of a particular class) without hard coding them? I want the program to prompt me to input a string of characters then make an object of that name. I have thought of using cin but I am still unsuccessful. Thanks for your time. Regards to all! ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Chris M. <lor...@gm...> - 2007-08-17 17:45:06
|
http://en.wikipedia.org/wiki/Factory_method_pattern http://en.wikipedia.org/wiki/Abstract_factory_pattern http://en.wikipedia.org/wiki/Singleton_pattern That's the easiest way I know of to create objects based on user input. Whenever you create an object, it needs to be hard coded somehow (otherwise you'd be using memory that's not yours!) but I think you just want to know how to make objects that are sensitive to pre-existing conditions in the executing environment. On 8/17/07, Tan, Clarencio <Cla...@an...> wrote: > Hi Guys, > > Can anyone tell me how to create objects (of a particular class) without > hard coding them? I want the program to prompt me to input a string of > characters then make an object of that name. I have thought of using cin > but I am still unsuccessful. Thanks for your time. > > Regards to all! > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Fernando L. <fer...@gm...> - 2007-08-17 13:27:17
|
Muhammad, Take a look at http://www.ross.net/crc/download/crc_v3.txt, there is sample working code there. Best regards, Fernando On 8/17/07, Muhammad Ammar <amm...@ho...> wrote: > > Hope everyone is good and fine. > > > how to Calculate of n-bit CRC with tabular method. > > > > Best Regards > > ________________________________ > New home for Mom, no cleanup required. All starts here. > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: > http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > -- Fernando Lichtschein li...@fi... |