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
(2) |
2
(2) |
3
|
4
|
5
|
6
|
7
|
8
|
9
(3) |
10
(6) |
11
|
12
|
13
(2) |
14
(1) |
15
|
16
(2) |
17
(12) |
18
(4) |
19
(1) |
20
(5) |
21
(3) |
22
(2) |
23
|
24
(5) |
25
(2) |
26
(2) |
27
(1) |
28
|
29
(2) |
30
|
31
|
|
From: Per W. <pw...@ia...> - 2007-08-29 12:43:50
|
There is no specific protocol. Ina command-line application, you can open the specific text device and send characters and command codes. In a Win32 graphical application you make use of a GDI to print. Look into Win32 or MFC documentation. /pwm On Wed, 29 Aug 2007, Frank Ryan wrote: > What is the protocol used with C++ to direct output to a printer rather than > to MSDos window or a file? > > |
From: Frank R. <fr...@fr...> - 2007-08-29 12:01:07
|
What is the protocol used with C++ to direct output to a printer rather than to MSDos window or a file? |
From: Adam J. <aj...@i-...> - 2007-08-27 02:21:05
|
>> You wrote: >>Hi, >>how can i read binary data from file and transform it into integer? >>I need to read first two bytes from a file encoded in big-endian and >>transform it into an integer. >>I'm running linux on a Intel at the moment but the file is created by a sun. >>I can i do that? >>Thanks, This is tricky. You really need to know what you are doing here. I am assuming that you have a reason or know that the binary in the file represents integers. Converting binary to integers may not be the correct thing, but if you know that the binary represenst integers, you will need to read the file in a byte at a time. Assemble the bytes in the correct order and then do the simple calculation of switching the assembled bytes into an integer assuming the bytes are in big-endian. This is pretty straight forward assuming you know the binary file specification. -Adam Jones i-softwareproducts.com |
From: Per W. <pw...@ia...> - 2007-08-26 08:54:44
|
Dod you notice anything strange with the errors you got? The template functions that contains the code in the mset.h file does not generate any warnings. If you spend some time thingking about it, you might realize why. Hint: If you make use of inline functions, should the full implementation of the inline function be visible to the compiler at the place where you call it? A template function may be instantiated a number of times, using a lot of different template parameters. Who is responsible to generate the actual code for each of these used template data types or limits? /pwm On Sun, 26 Aug 2007, Edward Hyl wrote: > hi, i'm edward. > i finish a program to implement the set with template. but when i > compling the program, there are some wrong: > > > [edward@localhost chapter8]$ make -f tset.mk > g++ -c -o tset.o tset.cpp > g++ -o tset tset.o mset.o > tset.o(.text+0x1e): In function `main': > : undefined reference to `Set<int>::Set[in-charge]()' > tset.o(.text+0x41): In function `main': > : undefined reference to `Set<int>::insert(int const&)' > tset.o(.text+0x64): In function `main': > : undefined reference to `Set<int>::insert(int const&)' > tset.o(.text+0x87): In function `main': > : undefined reference to `Set<int>::insert(int const&)' > tset.o(.text+0xd2): In function `main': > : undefined reference to `Set<int>::remove(int const&)' > tset.o(.text+0x12d): In function `main': > : undefined reference to `Set<int>::contains(int const&) const' > tset.o(.gnu.linkonce.t._ZlsIiERSoS0_RK3SetIT_E+0x10): In function > `std::basic_ostream<char, std::char_traits<char> >& operator<< > <int>(std::basic_ostream<char, std::char_traits<char> >&, Set<int> > const&)': > : undefined reference to `Set<int>::print(std::basic_ostream<char, > std::char_traits<char> >&) const' > collect2: ld returned 1 exit status > make: *** [tset] Error 1 > > > my complier is g++3.2 > > > > the source code are below > > > // tset.cpp > #include<iostream> > #include "mset.h" > > //using namespace std; > using std::cout; > using std::endl; > > int main(){ > Set<int> s; > > s.insert(77); > s.insert(33); > s.insert(500); > cout << s << endl; > > s.remove(77); > cout << s << endl; > cout <<"s "<<(s.contains(77)?"does":"does not")<<" contains 77" << endl; > > return 0; > } > > > > > // set.h: Set class template > #ifndef MSET_H > #define MSET_H > > #include <iostream> > //#include <algorithm> > #include <stddef.h> > > template<class T> > class Set{ > public: > Set(); > bool contains(const T&) const; > void insert(const T&); > void remove(const T&); > void print(std::ostream &)const; > > private: > enum{LIMIT = 64}; > T elems[LIMIT]; > size_t nelems; > }; > > template<class T> > std::ostream& operator<<(std::ostream& os, const Set<T>& s){ > s.print(os); > return os; > } > #endif // SET_H > > > > //: set.cpp: Implementation for Set class template > //#include "set.h" > #include <iostream> > #include <algorithm> > #include <stddef.h> > #include "mset.h" > using std::cout; > using std::endl; > using std::ostream; > template<class T> > Set<T>::Set(){ > nelems = 0; > } > > > template<class T> > bool Set<T>::contains(const T& x) const{ > const T* eof = elems + nelems; > return std::find(elems, eof, x) != eof; > } > > > template<class T> > void Set<T>::insert(const T& x){ > if (nelems < LIMIT && !contains(x)) > elems[nelems++] = x; > } > > template<class T> > void Set<T>::remove(const T& x){ > T* eof = elems + nelems; > if (std::remove(elems, eof, x) != eof) > --nelems; > } > > template<class T> > void Set<T>::print(std::ostream& os) const > { > os << '{'; > for (int i = 0; i < nelems; ++i){ > if (i > 0) > os << ','; > os << elems[i]; > } > > os << '}'; > } > > thanks for you 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: Edward H. <hyl...@gm...> - 2007-08-26 08:22:34
|
hi, i'm edward. i finish a program to implement the set with template. but when i compling the program, there are some wrong: [edward@localhost chapter8]$ make -f tset.mk g++ -c -o tset.o tset.cpp g++ -o tset tset.o mset.o tset.o(.text+0x1e): In function `main': : undefined reference to `Set<int>::Set[in-charge]()' tset.o(.text+0x41): In function `main': : undefined reference to `Set<int>::insert(int const&)' tset.o(.text+0x64): In function `main': : undefined reference to `Set<int>::insert(int const&)' tset.o(.text+0x87): In function `main': : undefined reference to `Set<int>::insert(int const&)' tset.o(.text+0xd2): In function `main': : undefined reference to `Set<int>::remove(int const&)' tset.o(.text+0x12d): In function `main': : undefined reference to `Set<int>::contains(int const&) const' tset.o(.gnu.linkonce.t._ZlsIiERSoS0_RK3SetIT_E+0x10): In function `std::basic_ostream<char, std::char_traits<char> >& operator<< <int>(std::basic_ostream<char, std::char_traits<char> >&, Set<int> const&)': : undefined reference to `Set<int>::print(std::basic_ostream<char, std::char_traits<char> >&) const' collect2: ld returned 1 exit status make: *** [tset] Error 1 my complier is g++3.2 the source code are below // tset.cpp #include<iostream> #include "mset.h" //using namespace std; using std::cout; using std::endl; int main(){ Set<int> s; s.insert(77); s.insert(33); s.insert(500); cout << s << endl; s.remove(77); cout << s << endl; cout <<"s "<<(s.contains(77)?"does":"does not")<<" contains 77" << endl; return 0; } // set.h: Set class template #ifndef MSET_H #define MSET_H #include <iostream> //#include <algorithm> #include <stddef.h> template<class T> class Set{ public: Set(); bool contains(const T&) const; void insert(const T&); void remove(const T&); void print(std::ostream &)const; private: enum{LIMIT = 64}; T elems[LIMIT]; size_t nelems; }; template<class T> std::ostream& operator<<(std::ostream& os, const Set<T>& s){ s.print(os); return os; } #endif // SET_H //: set.cpp: Implementation for Set class template //#include "set.h" #include <iostream> #include <algorithm> #include <stddef.h> #include "mset.h" using std::cout; using std::endl; using std::ostream; template<class T> Set<T>::Set(){ nelems = 0; } template<class T> bool Set<T>::contains(const T& x) const{ const T* eof = elems + nelems; return std::find(elems, eof, x) != eof; } template<class T> void Set<T>::insert(const T& x){ if (nelems < LIMIT && !contains(x)) elems[nelems++] = x; } template<class T> void Set<T>::remove(const T& x){ T* eof = elems + nelems; if (std::remove(elems, eof, x) != eof) --nelems; } template<class T> void Set<T>::print(std::ostream& os) const { os << '{'; for (int i = 0; i < nelems; ++i){ if (i > 0) os << ','; os << elems[i]; } os << '}'; } thanks for you all! |
From: Per W. <pw...@ia...> - 2007-08-25 20:17:38
|
Sorry, but your code doesn't seem to be readable. Maybe you should repost, and make sure that you have semicolons where there should be semicolons, and that there are no strange braces in the middle of the text. Look at the declaration of str in the private section of MyClass. Look at the strange declaration of temp in main. Look at the strange right brace at end of the assign to tmp. Also, read up on what auto_ptr is. Your MyClass constructor declares a local str variable. Didn't you plan on initializing the str in the private section? auto_ptr doesn't protect any pointers if you don't make sure that you always use it. Please visit http://en.wikipedia.org/wiki/Auto_ptr and spend some time, making sure that you understand what it is, and how to use it. Or check out the Boost library instead. /pwm On Sat, 25 Aug 2007, Jamiil Abduqadir wrote: > I would like to pass a variable pointer that has been instantiated using 'auto_ptr' to a class method, however, the compiler complains saying that it does not recognize the method call; gives me a number of options, basically the list of overloaded methods. So my question is, what is the proper way to pass 'auto_ptr('s)' to a method? > class MyClass{ > private: std::string str* > public: > MyClass(){ std::auto_ptr<std::string> str(new std::string("unknow"));} > MyMethod(const std::string& s){ str = s;} // <== Error?? > .......... > } > > main(){ > std::string temp* > std::auto_ptr<std::string> tmp(new std::string("hey!"));} > MyClass mc(); > mc.MyMethod(temp); // <<-- Error?? > ... > } |
From: Jamiil A. <jal...@gm...> - 2007-08-25 13:01:41
|
I would like to pass a variable pointer that has been instantiated using = 'auto_ptr' to a class method, however, the compiler complains saying = that it does not recognize the method call; gives me a number of = options, basically the list of overloaded methods. So my question is, = what is the proper way to pass 'auto_ptr('s)' to a method? class MyClass{ private: std::string str* public:=20 MyClass(){ std::auto_ptr<std::string> str(new = std::string("unknow"));} MyMethod(const std::string& s){ str =3D s;} // <=3D=3D Error?? .......... } main(){ std::string temp* std::auto_ptr<std::string> tmp(new std::string("hey!"));} MyClass mc(); mc.MyMethod(temp); // <<-- Error?? ... } |
From: Riccardo R. <rr...@pl...> - 2007-08-24 15:33:16
|
Hi, how can i read binary data from file and transform it into integer? I need to read first two bytes from a file encoded in big-endian and transform it into an integer. I'm running linux on a Intel at the moment but the file is created by a sun. I can i do that? Thanks, -- Riccardo Roasio |
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 |