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
(3) |
2
(24) |
3
(18) |
4
(23) |
5
|
6
(4) |
7
(14) |
8
(7) |
9
(2) |
10
(35) |
11
(11) |
12
(7) |
13
(25) |
14
(15) |
15
(18) |
16
(31) |
17
(28) |
18
(6) |
19
(9) |
20
(23) |
21
(7) |
22
|
23
(8) |
24
(15) |
25
(9) |
26
(3) |
27
(10) |
28
(9) |
29
(6) |
30
(25) |
31
(11) |
|
From: Jason H. <jas...@bt...> - 2002-05-13 23:55:02
|
A map associates a value to be stored with a key as an identifier. You use the key to access the stored value. Hence a dictionary is a map of words (key) and descriptions (value). Jason. ----- Original Message ----- From: "Daniel Glenfield" <sp...@ho...> To: <dev...@li...> Sent: Monday, May 13, 2002 10:25 AM Subject: [Dev-C++] Maps Can anyone give me a definition of what a 'map' is in C++ ? _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: ban...@so... _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Ioannis V. <no...@ho...> - 2002-05-13 22:23:55
|
clock_t clock(void); It returns the processor time that the program has spent so far from the beginning of its execution. clock()/CLOCKS_PER_SEC is that time in seconds (integer). #include <iostream> #include <ctime> void useless() { for(int i=0; i<1024*1024*1024; i++) ; } int main() { using namespace std; clock_t t1, t2; for(int i=0; i<100*1024*1024; i++) ; t1=clock(); cout<<"Time passed since the beginning of the program :"<<t1<<endl; cout<<"In seconds: "<< t1/CLOCKS_PER_SEC<<endl; t1=clock(); useless(); t2=clock(); cout<<"\nuseless() took "<<t2-t1<<" to complete\n"; cout<<"In seconds: "<<(t2-t1)/CLOCKS_PER_SEC<<endl; } Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Christian Faulhammer > Sent: Monday, May 13, 2002 10:23 PM > To: dev...@li... > Subject: [Dev-C++] System specific? > > > Hi Ioannis, > > > For portable code use the functions provided in time.h . > There is much > > useful stuff in there. > Good idea....if I could understand how to use it. The > original function > has been given to us by our teacher as a help...it's for > three weeks now > that I am in contact with C++. This routine should return a time (no > matter which, but in seconds would be great), so I can > measure the time > passed from start to end of the task given to the user. Is there a > portable solution or does the original function only work with gcc > greater than 2.95.3 (perhaps gcc 3.x)? > In the code I use MyTime as follows: > > ----------------------------8< schnipp------------------------------ > start=MyTime(); > [task] > end=MyTime(); > complete=(end - start) + (10 * penaltycounter); > ----------------------------schnapp >8------------------------------ > > You understand what I want? ;) > > Chau > > V-Li > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download > mirrors. We supply > the hardware. You get the recognition. Email Us: > ban...@so... > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: <v-...@ou...> - 2002-05-13 20:25:54
|
Hi Ioannis, > For portable code use the functions provided in time.h . There is much > useful stuff in there. Good idea....if I could understand how to use it. The original function has been given to us by our teacher as a help...it's for three weeks now that I am in contact with C++. This routine should return a time (no matter which, but in seconds would be great), so I can measure the time passed from start to end of the task given to the user. Is there a portable solution or does the original function only work with gcc greater than 2.95.3 (perhaps gcc 3.x)? In the code I use MyTime as follows: ----------------------------8< schnipp------------------------------ start=3DMyTime(); [task] end=3DMyTime(); complete=3D(end - start) + (10 * penaltycounter); ----------------------------schnapp >8------------------------------ You understand what I want? ;) Chau V-Li |
From: <v-...@ou...> - 2002-05-13 19:25:55
|
Hi Hongli, >> ----------------------------8< schnipp------------------------------ >> double MyTime() { >> struct timeval Tp; >> gettimeofday (&Tp, NULL); >> return Tp.tv_sec + (Tp.tv_usec /10000000.); >> } >> ----------------------------schnapp >8------------------------------ > I believe you need tin #include <sys/time.h> As I stated: Under Linux it does compile, and time.h is included, so this should be no problem. Below a list of all included header files. #include <iostream> using std::cout; using std::cin; #include <cstdlib> using std::rand; using std::srand; #include <sys/time.h> #include <cmath> using std::fmod; #include <iomanip> using std::setprecision; Chau V-Li |
From: Ioannis V. <no...@ho...> - 2002-05-13 18:37:22
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Christian Faulhammer > Sent: Monday, May 13, 2002 7:45 PM > To: To: dev...@li... > Subject: [Dev-C++] System specific? > > > Hello, > > In university I am doing a programming course and last week we had an > excercise using a given function to measure time: > > ----------------------------8< schnipp------------------------------ > double MyTime() { > struct timeval Tp; > gettimeofday (&Tp, NULL); > return Tp.tv_sec + (Tp.tv_usec /10000000.); > } > ----------------------------schnapp >8------------------------------ > > At home I wanted to finish the program using Dev-C++ (current > beta with > fixed exe), but the compiler refused work when compiling this function > with the message > > ----------------------------8< schnipp------------------------------ > aggregate `struct timeval Tp' has incomplete type and cannot be > initialized > ----------------------------schnapp >8------------------------------ > > But in university (under Linux) it does work....so is this a > problem of > the compiler (gcc versions differ in university and at home) or a > platform problem (Linux specific parts)? Sorry, I am no > expert, just had > two weeks of this course and I am only used to basic (under DOS). For portable code use the functions provided in time.h . There is much useful stuff in there. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |
From: Hongli L. <h....@ch...> - 2002-05-13 17:56:37
|
On Mon, 2002-05-13 at 18:45, Christian Faulhammer wrote: > Hello, > > In university I am doing a programming course and last week we had an > excercise using a given function to measure time: > > ----------------------------8< schnipp------------------------------ > double MyTime() { > struct timeval Tp; > gettimeofday (&Tp, NULL); > return Tp.tv_sec + (Tp.tv_usec /10000000.); > } > ----------------------------schnapp >8------------------------------ > > At home I wanted to finish the program using Dev-C++ (current beta with > fixed exe), but the compiler refused work when compiling this function > with the message > > ----------------------------8< schnipp------------------------------ > aggregate `struct timeval Tp' has incomplete type and cannot be > initialized > ----------------------------schnapp >8------------------------------ > > But in university (under Linux) it does work....so is this a problem of > the compiler (gcc versions differ in university and at home) or a > platform problem (Linux specific parts)? Sorry, I am no expert, just had > two weeks of this course and I am only used to basic (under DOS). > > Chau > I believe you need tin #include <sys/time.h> |
From: <v-...@ou...> - 2002-05-13 17:05:55
|
Hello, In university I am doing a programming course and last week we had an excercise using a given function to measure time: ----------------------------8< schnipp------------------------------ double MyTime() { struct timeval Tp; gettimeofday (&Tp, NULL); return Tp.tv_sec + (Tp.tv_usec /10000000.); } ----------------------------schnapp >8------------------------------ At home I wanted to finish the program using Dev-C++ (current beta with fixed exe), but the compiler refused work when compiling this function with the message ----------------------------8< schnipp------------------------------ aggregate `struct timeval Tp' has incomplete type and cannot be initialized ----------------------------schnapp >8------------------------------ But in university (under Linux) it does work....so is this a problem of the compiler (gcc versions differ in university and at home) or a platform problem (Linux specific parts)? Sorry, I am no expert, just had two weeks of this course and I am only used to basic (under DOS). Chau V-Li |
From: Graeme F. <gr...@dr...> - 2002-05-13 16:44:57
|
Reading and writing to a file is an important and common task. So I will try to explain the steps required. (As an aside I would do all of this in a wrapper class - other here may disagree with that because it will have over heads but it creates a much easer interface) To open a file: =============== I will just look at creating a text file. This makes it easier to test that you have written to the file correctly because you can open it up using notepad and check that the format is what you desired. First you need to have a variable to the file stream. I will create a file which can be used to read the file as well as write to it. It can be declared as follows: fstream iofile; Next the iofile variable needs to be associated with a file this can be done by using the open method of the fstream class as follows: iofile.open("MyFileName.txt"); Obviously you can use any name in the quotes, and any extension you like. Now did the file open work correctly? If it did then iofile will be a non-zero value so teh following test can check this: if (!(iofile)) cerr << "File " << "MyFileName.txt" << " couldn't be opened, sorry...\n"; Writing to the file: ==================== First you need to write to the file the following code will write out a line to the file, in this case it will write the contents of the variable called line to the file followed by a new line. (The variable line was declared as a string object, but it should manage any data type that has to output operator << defined) iofile << line << "\n"; Reading from the file ===================== There are many ways to do this, my preferred approach is to read the data in a line at a time and then extract the information from that line however you may want to adopt a different approach maybe by using the input operator >>. However to read a whole line in: char data [1024]; // read in the next line and store it in details of cObject iofile.getline(data,1024); string result (data); return result; This code creates a temporary variable called data that is a character array and will have more space than I need to read in a single line. The data is then read into this variable using the getline method of the fstream class. I then copy it to string object called result. This code is part of a function and I return result where it can then be parsed and the data extracted. For your application you don't need data to be anywhere near as large as 1024 chars, and as I said you may want to experiment with the input operator << Position in the file ==================== The file has two "positions" in the file one is related to the writing and the other is related to the reading. These can be set using the following functions iofile.seekg(0) // sets the read (or get) position to the start of the file iofile.seekp(0) // set the write (or put) position to the start of the file Buffers ======= If you are working in mixed mode i.e. read write and then read some more you will be well advised to flush the buffers to ensure that your data is actually written to the file rather than sitting on the buffer: iofile.flush(); Clear the File ============== There are several ways to empty a file one simple approach is to close the file and then open it but truncate the file to length zero. This is done as follows: // Close the file and then reopen it but truncate to zero iofile.close(); iofile.open("MyFileName.txt", ios_base::in|ios_base::out|ios_base::trunc); This is slightly different from the previous open method, because now it has a second parameter. This second parameter using flags to tell the program how it should treat the file. The flags are in the namespace called ios_base and the three flags used are in (for input - read), out (yeap output - write) and trunc (truncate to zero) hope this helps. Graeme. >Message: 2 >From: "chromatonus 712" <chr...@ho...> >To: dev...@li... >Date: Mon, 13 May 2002 01:16:58 +0000 >Subject: [Dev-C++] how to do file and streams > >hi, here is my program that is supposed to do the following: > >Enter a series of records from the keyboard, each record consisting of a >two-word name and an integer, >example MEG RAM 23, as one entry >The program will keep a count of the number of entries. After the last one >is entered, enter a "sentinel" code, some string that will indicate that the >data has been completely entered. >Then the data will be saved to a file in the format of >#data name # name #....... >Then the data will be read from the file and displayed on the screen, one >entry per line.... |
From: TAN_Boon_Phing <bp...@po...> - 2002-05-13 16:34:38
|
Hello, anyone have tried using Dev C++ and Intel SPLib? Any tips for me to set it up with Dev C++? -- Best regards, Boon Phing |
From: Hongli L. <h....@ch...> - 2002-05-13 16:17:12
|
On Mon, 2002-05-13 at 17:22, Bob Wilson wrote: > Okay, I'll bite. Why are they evil? > > Please... no HTML mail! They're evil. > Ah, finally somebody asks! Here's my list of arguments: 1) You're only sending an email here. Markups are completely redundant. All this HTML only waste space and bandwidth. 2) HTML mail with hardcoded fontnames look horrible in my Linux emailclient. 3) HTML mail can contain script viruses. 4) HTML mail mess up the archives. When you try to see a message in the archive, you see all the HTML code instead of the email! Also read this page! http://www.georgedillon.com/web/html_email_is_evil.shtml |
From: Hongli L. <h....@ch...> - 2002-05-13 16:09:30
|
On Mon, 2002-05-13 at 16:38, Fernandes Evert wrote: > Hi all, > > I'm an experienced Unix C/C++ programmer. A while ago I tried my first steps > on the Windows programming ice, and although I've slipped a few times, I'm > slowly getting my head around it. I've managed to conjure up some windows, > get event handling going, etc. > > I've chosen Dev C++ as my development tool, and despite some interesting > comments I read in previous messages, I'm pretty happy with it. (Hey, the > price is right! :)) > > Anyway, I was wondering if anyone could point me in the direction of a good > tutorial for the Resource Editor, provided with Dev C++. I've searched far > and wide, but I can't seem to get any useful information regarding setting > up a rsrc.rc file. > > If anyone could help me, it would be most appreciated. > > Thanks in advance, > > Sander Fernandes > > If setting up an icon for your program is what you need: Dev-C++ beta 3 will do this automatically for you. There may be some information on the MSDN site (http://msdn.microsoft.com) regarding resource scripts. |
From: Bob W. <bo...@ph...> - 2002-05-13 15:19:54
|
Okay, I'll bite. Why are they evil? Please... no HTML mail! They're evil. |
From: Bob W. <bo...@ph...> - 2002-05-13 15:18:20
|
There is only one small problem. If you are trying to write portable = code, <conio_mingw.h> is not universal. ----- Original Message -----=20 From: Abhijit Shylanath=20 To: Dev C++=20 Sent: Saturday, May 11, 2002 5:31 AM Subject: Re: [Dev-C++] gotoxy In place of #include <conio.h> try using #include <conio_mingw.h> This is a header file containing conio functions under mingw. think---. ] feel----. # .---- connect listen--. =B2 .---- www.megadeth.com live----. ^ http://mudeth.tripod.com=20 |
From: Fernandes E. <Eve...@aa...> - 2002-05-13 14:38:04
|
Hi all, I'm an experienced Unix C/C++ programmer. A while ago I tried my first steps on the Windows programming ice, and although I've slipped a few times, I'm slowly getting my head around it. I've managed to conjure up some windows, get event handling going, etc. I've chosen Dev C++ as my development tool, and despite some interesting comments I read in previous messages, I'm pretty happy with it. (Hey, the price is right! :)) Anyway, I was wondering if anyone could point me in the direction of a good tutorial for the Resource Editor, provided with Dev C++. I've searched far and wide, but I can't seem to get any useful information regarding setting up a rsrc.rc file. If anyone could help me, it would be most appreciated. Thanks in advance, Sander Fernandes ************************************************************************ DISCLAIMER The information contained in this e-mail is confidential and is intended for the recipient only. If you have received it in error, please notify us immediately by reply e-mail and then delete it from your system. Please do not copy it or use it for any other purposes, or disclose the content of the e-mail to any other person or store or copy the information in any medium. The views contained in this e-mail are those of the author and not necessarily those of GEHE Group companies. ************************************************************************ |
From: staale <st...@le...> - 2002-05-13 12:53:57
|
Looks like the debugg button has a problem. It seams to work when I use = the menu.=20 The Tools - compiler options - linker - 'Generate deb...' has to be = checked. Regards Staale ----- Original Message -----=20 From: staale=20 To: Dev-Cpp=20 Sent: Monday, May 13, 2002 11:10 AM Subject: [Dev-C++] How do I turn the debugger on in Dev-C 5 (4.9.2.0) When I try to debugg my programs in the latest release I get a "You = need to put debugging mode on before debugging" message in the debuger = window. How do I turn on debugger mode? Regards Staale Flock |
From: Ioannis V. <no...@ho...> - 2002-05-13 09:50:41
|
Associative container. In the style town_counters["London"]=7; Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Daniel Glenfield > Sent: Monday, May 13, 2002 12:26 PM > To: dev...@li... > Subject: [Dev-C++] Maps > > > Can anyone give me a definition of what a 'map' is in C++ ? > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download > mirrors. We supply > the hardware. You get the recognition. Email Us: > ban...@so... > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: <tar...@wi...> - 2002-05-13 09:45:52
|
Daniel Glenfield wrote: > Can anyone give me a definition of what a 'map' is in C++ ? A map is a template class in the STL (standard template library). Look into STL documentation. Adib. > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Daniel G. <sp...@ho...> - 2002-05-13 09:25:47
|
Can anyone give me a definition of what a 'map' is in C++ ? _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |
From: staale <st...@le...> - 2002-05-13 09:07:05
|
When I try to debugg my programs in the latest release I get a "You need = to put debugging mode on before debugging" message in the debuger = window. How do I turn on debugger mode? Regards Staale Flock |
From: Daniel G. <sp...@ho...> - 2002-05-13 08:01:59
|
I think if you include ostream.h and create an object of the ostream class, then use the .open command you should be ok. ofstream ofstreamObject; // For managing the text file ofstreamObject.open( "File1.txt"); // Create and name our text file ofstreamObject.close(); >From: "chromatonus 712" <chr...@ho...> >To: dev...@li... >Subject: [Dev-C++] how to do file and streams >Date: Mon, 13 May 2002 01:16:58 +0000 > >hi, here is my program that is supposed to do the following: > >Enter a series of records from the keyboard, each record consisting of a >two-word name and an integer, >example MEG RAM 23, as one entry >The program will keep a count of the number of entries. After the last one >is entered, enter a "sentinel" code, some string that will indicate that >the >data has been completely entered. >Then the data will be saved to a file in the format of >#data name # name #....... >Then the data will be read from the file and displayed on the screen, one >entry per line. > >#include "apstring.h" >#include <iostream.h> >#include <fstream.h> >#include <conio.h> > >int main() >{ > apstring name1, name2, x, check; > ifstream infile; > infile.open("stuff.dat"); > int n; > cin.ignore(80,'\n'); > getline(cin,x); > check = "end"; > while(x!=check) > { > infile >> name1 >> name2 >> n >> "\n"; > cin.ignore(80,'\n'); > getline(cin, x); > } > infile.close(); > getch(); > > ofstream xfile; > xfile.open("stuff.dat"); > getch(); > xfile.close(); >} > >I don't know how to do the ofstream part, and I don't know whether I >actually saved the data in a file, and how to access the file and display >it? Would you please tell me how to do that, thank you! > > > > >_________________________________________________________________ >Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. > > >_______________________________________________________________ > >Have big pipes? SourceForge.net is looking for download mirrors. We supply >the hardware. You get the recognition. Email Us: ban...@so... >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
From: Ioannis V. <no...@ho...> - 2002-05-13 06:39:30
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of staale > Sent: Monday, May 13, 2002 9:05 AM > To: Dev-C++ Mailing List > Subject: Re: [DEV-C++] BUG: Dev-C 4.9.20 consolprogram has > only access to 1MB memory. > > > Well, I'll hold my horses a bit longer before I cry wolf, > wolf the next > time.:o) > > As Ioannis has pointed out the different results are > differences in the > implementation of the mingw32 compiler. Evolving from > allowing ca 31MB stack > space to ca 2MB. Probably to prevent us from cheating? > > The following code shows that you have access to all the > memory your OS will > give you *S*. > > New return 0 if out of mem (I think!) No, in case of failure new throws by default an std::bad_alloc exception defined in <new>. It doesn't return 0. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |
From: Ioannis V. <no...@ho...> - 2002-05-13 06:22:00
|
Yes, you can access the rest of memory as "free store". Stack is used to store the execution path of a program and local objects. Example. Imagine that you have the code: void k() { int x=1; f(); int y=g(x); f(); } int main() { int a=5; f(); int r=g(a); k(); } In the stack the following is stored: a=5; pointer to f() call. -> // f() things executed here. When it finishes: | <----------------------------------------------------------------------- ------- int r; pointer to g() call--> // g() things executed here. When it finishes: | <----------------------------------------------------------------------- -------- r=some_value pointer to k() call --> int x=1; pointer to f() call ---> //finishes | <------------------------------------- int y; pointer to g() call---> // finishes| <-------------------------------------- y=some_value pointer to f() call ---> //finishes | <------------------------------------- k() finishes. Automatic local objects in the stack die | <----------------------------------------------------------------------- ---------------- main() ends. Automatic local objects in the stack die return success indicator I hope it gives some idea. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of staale > Sent: Monday, May 13, 2002 9:05 AM > To: Dev-C++ Mailing List > Subject: Re: [DEV-C++] BUG: Dev-C 4.9.20 consolprogram has > only access to 1MB memory. > > > Well, I'll hold my horses a bit longer before I cry wolf, > wolf the next > time.:o) > > As Ioannis has pointed out the different results are > differences in the > implementation of the mingw32 compiler. Evolving from > allowing ca 31MB stack > space to ca 2MB. Probably to prevent us from cheating? > > The following code shows that you have access to all the > memory your OS will > give you *S*. |
From: staale <st...@le...> - 2002-05-13 06:01:09
|
Well, I'll hold my horses a bit longer before I cry wolf, wolf the next time.:o) As Ioannis has pointed out the different results are differences in the implementation of the mingw32 compiler. Evolving from allowing ca 31MB stack space to ca 2MB. Probably to prevent us from cheating? The following code shows that you have access to all the memory your OS will give you *S*. ------------ Code snip ------------------- // This code consumes memmory on the heap (free storage) // *********************************** // Se also Bruce Eckel 's book Thinking in C++ // page 565 - Running out of storage. // pdf Available at www.BruceEckel.com // *********************************** #include <iostream> int count = 0; int main() { while(true) { count++; // Analyse mem usage with // task manager (NT) or ps, KPM (Linux) int* foo = new int[1024]; // allocate ca 1kB on heap (free storage) if (foo == 0) break; // New return 0 if out of mem (I think!) cout << count << endl; } cout << "new could not allocate more memmory\b" << endl; return 0; } -----------Code end --------------------- Best regards Staale Flock ----- Original Message ----- From: "Ioannis Vranos" <no...@ho...> To: "Dev-C++ Mailing List" <dev...@li...> Sent: Friday, May 10, 2002 6:13 PM Subject: RE: [DEV-C++] BUG: Dev-C 4.9.20 consolprogram has only access to 1MB memory. > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf Of staale > > Sent: Friday, May 10, 2002 12:12 PM > > To: Dev-C++ Mailing List > > Subject: Re: [DEV-C++] BUG: Dev-C 4.9.20 consolprogram has > > only access to 1MB memory. > > > > > > Ioannis and Helmut, > > > > Out of curiosity I tried Ioannis's code in VC6++ SP4 > > (w2k-machine) , and > > KDeveloper 2.0 (RedHat 7.2 - gcc 2.95.x ? ) and the results are: > > VC6++ 936 kB > > KDeveloper 8064 kB > > > > For fun I tried it in VB and Powerbasic to: > > VB6 4382 kB > > PB 4309 kB > > Basic? How did you run C++ code in BASIC (except if you mean you wrote > equivallent recursive BASIC code). > > > > > > I'm still puzzeled by the big difference between the two > > Dev-C releases. The > > only logical explenation is that it is posible to configure > > this somewhere. > > > Yes, it is done inside MINGW's source code. :P > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.cjb.net > * Alternative URL: http://run.to/noicys > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Ioannis V. <no...@ho...> - 2002-05-13 03:48:26
|
I was looking to some pages regarding Kernighan, Ritchie, Thompson, Unix & stuff and i came across some interesting link of a guy that was working at Bell Labos those times (great mind) with info i think is interesting. It is not C or C++ but i think it is useful. :) http://www.wired.com/wired/archive/8.04/joy.html Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys |
From: chromatonus 7. <chr...@ho...> - 2002-05-13 01:17:06
|
hi, here is my program that is supposed to do the following: Enter a series of records from the keyboard, each record consisting of a two-word name and an integer, example MEG RAM 23, as one entry The program will keep a count of the number of entries. After the last one is entered, enter a "sentinel" code, some string that will indicate that the data has been completely entered. Then the data will be saved to a file in the format of #data name # name #....... Then the data will be read from the file and displayed on the screen, one entry per line. #include "apstring.h" #include <iostream.h> #include <fstream.h> #include <conio.h> int main() { apstring name1, name2, x, check; ifstream infile; infile.open("stuff.dat"); int n; cin.ignore(80,'\n'); getline(cin,x); check = "end"; while(x!=check) { infile >> name1 >> name2 >> n >> "\n"; cin.ignore(80,'\n'); getline(cin, x); } infile.close(); getch(); ofstream xfile; xfile.open("stuff.dat"); getch(); xfile.close(); } I don't know how to do the ofstream part, and I don't know whether I actually saved the data in a file, and how to access the file and display it? Would you please tell me how to do that, thank you! _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |