dev-cpp-users Mailing List for Dev-C++ (Page 54)
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: matheus r. <mfr...@gm...> - 2007-07-29 16:07:40
|
Hi, templates can create a great mess sometimes. Try the following: @line 133: typename std::vector<ArvoreB>::iterator it_filho; This helps the compiler understand that iterator is a type. 2007/7/29, Kristian Magnani <kri...@ya...>: > > Hi, all! > > I'm developing a B-Tree class as a template, but I got an error I can't > solve. The compiler complains that I should put a ';'before the "it_filho" > identifier in the line 133 of the attached file, but I really don't know why > I can not declare such an iterator. > > Does anyone know what I'm doing wrong? > > Thanks a lot, > > Kristian > > > > ________________________________ > Pinpoint customers who are looking for what you sell. > ------------------------------------------------------------------------- > 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: Kristian M. <kri...@ya...> - 2007-07-29 13:56:59
|
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSAiQXJ2b3JlQi5oIgoKaW50 IG1haW4oaW50IGFyZ2MsIGNoYXIqIGFyZ3ZbXSkKewogIEFydm9yZUI8aW50 PiBhcnZvcmUoMik7CiAgCiAgcmV0dXJuIDA7Cn0= |
From: Roger F. <ra...@ha...> - 2007-07-29 03:11:34
|
Aloha from Honolulu, Check spelling of file name in the directory. I once made an error in spelling and because I used the "Save" in the menu or the icon I didn't realize the mistake. But the compiler kept saying it couldn't find the file. Perhaps something similar is happening. Mistake can also be capital letter in one instance and no caps in another. Aloha, Roger wangtao wrote: > I just use the examples under "C:\Dev-Cpp\Examples\Hello",the same error > occurs > > On 7/27/07, *Per Westermark* <pw...@ia... > <mailto:pw...@ia...>> wrote: > > Have you tried to create a project in a directory path that doesn't > contain a space? You should always be careful with the use of spaces in > directory name - quite a lot of development tools are affected! > > /pwm > > On Fri, 27 Jul 2007, wangtao wrote: > > > Hi all, > > > > I have newly installed the Dec-C++,I used all the default setups. > > Then I new a Console Application project and without adding any code > > line,when I compile it,an error returned: > > " CreateProcess(C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, > > C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, ...) failed. " > > " The system cannot find the file specified. " > > " D:\Users\atao\Exercise\Dev > Projects\dev_pro4\Makefile.win" "[Build > > Error] [main.o] Error 2 " > > I can not make out what's the problem,would you pls tell me why > it is if you > > know? > > Thanks a lot! > > > > -- > > Kind Regards > > Tony Wang > > > > > > > -- > Kind Regards > Tony Wang > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > 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: Per W. <pw...@ia...> - 2007-07-28 20:20:43
|
Please, use ASCII mail when posting to this list. Not all people are using a web-baseed email reader... You seem to be using a very funny indentation. Please don't. To access an element of an array, you should write array[0].member =3D 10; You can not write lines like 1.name =3D "hydrogen". Observe also that in C/C++, an array starts with index 0, and not index 1. /pwm On Sat, 28 Jul 2007, J Hall wrote: > > Here is a program that I have been working on.when I compile, i get an in= valid suffix on floating const error on all the elements of the members of = struct elements.Is this the type of situation that a pointer would help?It = seems that since the periodic table has numbers 1-112, I ought to be able t= o write a loop that gives the struct elements the members 1-112 ,any ideas?= using namespace std;int i,e;char x[3];main(){for (i=3D1;i < 5;++i) { = struct elements{ string name; int atomic_no; float atomi= c_weight; }i; } 1.name =3D "hydrogen"; 1.atomic_no = =3D 1; 1.atomic_weight =3D 1.007794; 2.name =3D "helium"; = 2.atomic_no =3D 2; 2.atomic_weight =3D 4; 3.name =3D "lithium"; = 3.atomic_no =3D 3; 3.atomic_weight =3D 6.941; 4.name =3D "bery= lium"; 4.atomic_no =3D 4; 4.atomic_weight =3D 9.012182; 5.nam= e =3D"boron"; 5.atomic_no =3D 5; 5.atomic_weight =3D 10.81= 1; string element; string title("\n\t You have selected :\t"); string = no("\n\t The atomic number for "); string is(" is:\t"); string wgt("\n\t Th= e atomic weight is:\t");printf ("\t The Begining of the Periodic Table of t= he Elements \n");printf ("\t In the hopes of learning C programming and ele= mental values. \n\n\n"); do {cout << "\n\t Please enter an Element you woul= d like to examine : " ;cin >> element;if (element =3D=3D 1.name) { = cout << title << 1.name; cout << no << 1.name << is << 1.ato= mic_no; cout << wgt << 1.atomic_weight; } else if (el= ement =3D=3D 2.name) { cout << title << 2.name; cout= << no << 2.name << is << 2.atomic_no; cout << wgt << 2.atomic_w= eight; } else if (element =3D=3D 3.name) { cout << t= itle << 3.name; cout << no << 3.name << is << 3.atomic_no; = cout << wgt << 3.atomic_weight;} else if (element =3D=3D 3= =2Ename) { cout << title << 3.name; cout << no << 3.= name << is << 3.atomic_no; cout << wgt << 3.atomic_weight;} = else if (element =3D=3D 4.name) { cout << title << 4.nam= e; cout << no << 4.name << is << 4.atomic_no; cout <<= wgt << 4.atomic_weight;} else if (element =3D=3D 5.name) { = cout << title << 5.name; cout << no << 5.name << is << 5= =2Eatomic_no; cout << wgt << 5.atomic_weight;} cout <= < "\n\n\t Again Yes/No :"; cin >> x;}while (!strcmp(x,"yes")) ;} > _________________________________________________________________ > See what you=92re getting into=85before you go there. > http://newlivehotmail.com |
From: Jonathan W. <jon...@gm...> - 2007-07-28 20:17:40
|
Hi, You are making a mistake when you try to declare all your structs : for (i=1;i < 5;++i) { struct elements{ string name; int atomic_no; float atomic_weight; } i; } This will not declare 5 structs, called '1' through '5', but all called 'i'. They will also be local to the inside of the loop: at the end of each iteration of the loop they will be destroyed. Therefore these references to the structs are invalid. 1.name = "hydrogen"; 1.atomic_no = 1; 1.atomic_weight = 1.007794; [...] Also, you should note that variable names cannot begin with numbers: the compiler saw number, period, something, and interpreted that as a floating point number, except the 'something' wasn't the rest of a float. in the rest of your program, you test against each struct in a if/elseif , this is a good place to use a loop. A better way of writing the program would be: A. declare the struct and give it a name (eg if you want to make a new one sometime, you don't have to rerite the struct declaration) so: typedef struct _Element { //members } Element; You can now use this stuct by using 'struct _Element' or 'Element' B. declare an array of these structs. I trust you'll manage this C. fill the structs, referencing the elements in the array: elements[1].name = "hydrogen"; and so on D. you're ready to roll: get input, loop through the array, testing the names hope this will point you in the right direction. Cheers, Jonathan PS. Sorry for the double post, bad aiming for a click.... On 7/28/07, J Hall <jsh...@ho...> wrote: > > Here is a program that I have been working on. > when I compile, i get an invalid suffix on floating const error on all the > elements of the members of struct elements. > Is this the type of situation that a pointer would help? > It seems that since the periodic table has numbers 1-112, I ought to be > able to write a loop > that gives the struct elements the members 1-112 , > any ideas? > > > > > > > using namespace std; > int i,e; > > char x[3]; > main() > > {for (i=1;i < 5;++i) { > struct elements{ > string name; > int atomic_no; > float atomic_weight; > }i; > } > 1.name = "hydrogen"; > 1.atomic_no = 1; > 1.atomic_weight = 1.007794 ; > 2.name = "helium"; > 2.atomic_no = 2; > 2.atomic_weight = 4; > 3.name = "lithium"; > 3.atomic_no = 3; > 3.atomic_weight = 6.941; > 4.name = "berylium"; > 4.atomic_no = 4; > 4.atomic_weight = 9.012182; > 5.name ="boron"; > 5.atomic_no = 5; > 5.atomic_weight = 10.811; > > > string element; > string title("\n\t You have selected :\t"); > string no("\n\t The atomic number for "); > string is(" is:\t"); > string wgt("\n\t The atomic weight is:\t"); > printf ("\t The Begining of the Periodic Table of the Elements \n"); > printf ("\t In the hopes of learning C programming and elemental values. > \n\n\n"); > do { > cout << "\n\t Please enter an Element you would like to examine : " ; > cin >> element; > > if (element == 1.name) { > > cout << title << 1.name; > cout << no << 1.name << is << 1.atomic_no; > cout << wgt << 1.atomic_weight; > } > > else if (element == 2.name) { > > cout << title << 2.name; > cout << no << 2.name << is << 2.atomic_no; > cout << wgt << 2.atomic_weight; > } > > else if (element == 3.name) { > > cout << title << 3.name; > cout << no << 3.name << is << 3.atomic_no; > cout << wgt << 3.atomic_weight;} > > else if (element == 3.name) { > > cout << title << 3.name; > cout << no << 3.name << is << 3.atomic_no; > cout << wgt << 3.atomic_weight;} > > else if (element == 4.name) { > > cout << title << 4.name; > cout << no << 4.name << is << 4.atomic_no; > cout << wgt << 4.atomic_weight;} > > else if (element == 5.name) { > > cout << title << 5.name; > cout << no << 5.name << is << 5.atomic_no; > cout << wgt << 5.atomic_weight;} > > cout << "\n\n\t Again Yes/No :"; > cin >> x;} > while (!strcmp(x,"yes")) ; > > > > } > |
From: Jonathan W. <jon...@gm...> - 2007-07-28 20:05:13
|
Hi, You are making a mistake when you try to declare all your structs : for (i=3D1;i < 5;++i) { struct elements{ string name; int atomic_no; float atomic_weight; } i; } This will not declare 5 structs, called '1' through '5', but all called 'i'= . They will also be local to the inside of the loop: at the ed of each iteration of the loop thez will be destroyed. Therfore these references to the structs are invalid 1.name =3D "hydrogen"; 1.atomic_no =3D 1; 1.atomic_weight =3D 1.007794; 2.name =3D "helium"; 2.atomic_no =3D 2; 2.atomic_weight =3D 4; 3.name =3D "lithium"; 3.atomic_no =3D 3; 3.atomic_weight =3D 6.941; 4.name =3D "berylium"; 4.atomic_no =3D 4; 4.atomic_weight =3D 9.012182; 5.name =3D"boron"; 5.atomic_no =3D 5; 5.atomic_weight =3D 10.811; string element; string title("\n\t You have selected :\t"); string no("\n\t The atomic number for "); string is(" is:\t"); string wgt("\n\t The atomic weight is:\t"); printf ("\t The Begining of the Periodic Table of the Elements \n"); printf ("\t In the hopes of learning C programming and elemental values. \n\n\n"); do { cout << "\n\t Please enter an Element you would like to examine : " ; cin >> element; if (element =3D=3D 1.name) { cout << title << 1.name; cout << no << 1.name << is << 1.atomic_no; cout << wgt << 1.atomic_weight; } else if (element =3D=3D 2.name) { cout << title << 2.name; cout << no << 2.name << is << 2.atomic_no; cout << wgt << 2.atomic_weight; } else if (element =3D=3D 3.name) { cout << title << 3.name; cout << no << 3.name << is << 3.atomic_no; cout << wgt << 3.atomic_weight;} else if (element =3D=3D 3.name) { cout << title << 3.name; cout << no << 3.name << is << 3.atomic_no; cout << wgt << 3.atomic_weight ;} else if (element =3D=3D 4.name) { cout << title << 4.name; cout << no << 4.name << is << 4.atomic_no; cout << wgt << 4.atomic_weight;} else if (element =3D=3D 5.name) { cout << title << 5.name; cout << no << 5.name << is << 5.atomic_no; cout << wgt << 5.atomic_weight;} cout << "\n\n\t Again Yes/No :"; cin >> x;} while (!strcmp(x,"yes")) ; } On 7/28/07, J Hall <jsh...@ho...> wrote: > > Here is a program that I have been working on. > when I compile, i get an invalid suffix on floating const error on all th= e > elements of the members of struct elements. > Is this the type of situation that a pointer would help? > It seems that since the periodic table has numbers 1-112, I ought to be > able to write a loop > that gives the struct elements the members 1-112 , > any ideas? > > > > > > > using namespace std; > int i,e; > > char x[3]; > main() > > {for (i=3D1;i < 5;++i) { > struct elements{ > string name; > int atomic_no; > float atomic_weight; > }i; > } > 1.name =3D "hydrogen"; > 1.atomic_no =3D 1; > 1.atomic_weight =3D 1.007794 ; > 2.name =3D "helium"; > 2.atomic_no =3D 2; > 2.atomic_weight =3D 4; > 3.name =3D "lithium"; > 3.atomic_no =3D 3; > 3.atomic_weight =3D 6.941; > 4.name =3D "berylium"; > 4.atomic_no =3D 4; > 4.atomic_weight =3D 9.012182; > 5.name =3D"boron"; > 5.atomic_no =3D 5; > 5.atomic_weight =3D 10.811; > > > string element; > string title("\n\t You have selected :\t"); > string no("\n\t The atomic number for "); > string is(" is:\t"); > string wgt("\n\t The atomic weight is:\t"); > printf ("\t The Begining of the Periodic Table of the Elements \n"); > printf ("\t In the hopes of learning C programming and elemental values. > \n\n\n"); > do { > cout << "\n\t Please enter an Element you would like to examine : " ; > cin >> element; > > if (element =3D=3D 1.name) { > > cout << title << 1.name; > cout << no << 1.name << is << 1.atomic_no; > cout << wgt << 1.atomic_weight; > } > > else if (element =3D=3D 2.name) { > > cout << title << 2.name; > cout << no << 2.name << is << 2.atomic_no; > cout << wgt << 2.atomic_weight; > } > > else if (element =3D=3D 3.name) { > > cout << title << 3.name; > cout << no << 3.name << is << 3.atomic_no; > cout << wgt << 3.atomic_weight;} > > else if (element =3D=3D 3.name) { > > cout << title << 3.name; > cout << no << 3.name << is << 3.atomic_no; > cout << wgt << 3.atomic_weight;} > > else if (element =3D=3D 4.name) { > > cout << title << 4.name; > cout << no << 4.name << is << 4.atomic_no; > cout << wgt << 4.atomic_weight;} > > else if (element =3D=3D 5.name) { > > cout << title << 5.name; > cout << no << 5.name << is << 5.atomic_no; > cout << wgt << 5.atomic_weight;} > > cout << "\n\n\t Again Yes/No :"; > cin >> x;} > while (!strcmp(x,"yes")) ; > > > > } > > > > ------------------------------ > See what you're getting into=85before you go there. Check it out!<http://= newlivehotmail.com> > > ------------------------------------------------------------------------- > 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 > > --=20 <Morpheus> linux, c'est une question de VI ou de MORE |
From: J H. <jsh...@ho...> - 2007-07-28 17:37:38
|
Here is a program that I have been working on.when I compile, i get an inva= lid suffix on floating const error on all the elements of the members of st= ruct elements.Is this the type of situation that a pointer would help?It se= ems that since the periodic table has numbers 1-112, I ought to be able to = write a loop that gives the struct elements the members 1-112 ,any ideas?us= ing namespace std;int i,e;char x[3];main(){for (i=3D1;i < 5;++i) { s= truct elements{ string name; int atomic_no; float atomic_= weight; }i; } 1.name =3D "hydrogen"; 1.atomic_no =3D= 1; 1.atomic_weight =3D 1.007794; 2.name =3D "helium"; 2= .atomic_no =3D 2; 2.atomic_weight =3D 4; 3.name =3D "lithium"; = 3.atomic_no =3D 3; 3.atomic_weight =3D 6.941; 4.name =3D "beryliu= m"; 4.atomic_no =3D 4; 4.atomic_weight =3D 9.012182; 5.name = =3D"boron"; 5.atomic_no =3D 5; 5.atomic_weight =3D 10.811;= string element; string title("\n\t You have selected :\t"); string no= ("\n\t The atomic number for "); string is(" is:\t"); string wgt("\n\t The = atomic weight is:\t");printf ("\t The Begining of the Periodic Table of the= Elements \n");printf ("\t In the hopes of learning C programming and eleme= ntal values. \n\n\n"); do {cout << "\n\t Please enter an Element you would = like to examine : " ;cin >> element;if (element =3D=3D 1.name) { = cout << title << 1.name; cout << no << 1.name << is << 1.atomi= c_no; cout << wgt << 1.atomic_weight; } else if (elem= ent =3D=3D 2.name) { cout << title << 2.name; cout <= < no << 2.name << is << 2.atomic_no; cout << wgt << 2.atomic_wei= ght; } else if (element =3D=3D 3.name) { cout << tit= le << 3.name; cout << no << 3.name << is << 3.atomic_no; = cout << wgt << 3.atomic_weight;} else if (element =3D=3D 3.n= ame) { cout << title << 3.name; cout << no << 3.name= << is << 3.atomic_no; cout << wgt << 3.atomic_weight;} = else if (element =3D=3D 4.name) { cout << title << 4.name; = cout << no << 4.name << is << 4.atomic_no; cout << wgt= << 4.atomic_weight;} else if (element =3D=3D 5.name) { = cout << title << 5.name; cout << no << 5.name << is << 5.ato= mic_no; cout << wgt << 5.atomic_weight;} cout << "\n\= n\t Again Yes/No :"; cin >> x;}while (!strcmp(x,"yes")) ;} _________________________________________________________________ See what you=92re getting into=85before you go there. http://newlivehotmail.com= |
From: J H. <jsh...@ho...> - 2007-07-28 17:37:04
|
Here is a program that I have been working on.when I compile, i get an inva= lid suffix on floating const error on all the elements of the members of st= ruct elements.Is this the type of situation that a pointer would help?It se= ems that since the periodic table has numbers 1-112, I ought to be able to = write a loop that gives the struct elements the members 1-112 ,any ideas?us= ing namespace std;int i,e;char x[3];main(){for (i=3D1;i < 5;++i) { s= truct elements{ string name; int atomic_no; float atomic_= weight; }i; } 1.name =3D "hydrogen"; 1.atomic_no =3D= 1; 1.atomic_weight =3D 1.007794; 2.name =3D "helium"; 2= .atomic_no =3D 2; 2.atomic_weight =3D 4; 3.name =3D "lithium"; = 3.atomic_no =3D 3; 3.atomic_weight =3D 6.941; 4.name =3D "beryliu= m"; 4.atomic_no =3D 4; 4.atomic_weight =3D 9.012182; 5.name = =3D"boron"; 5.atomic_no =3D 5; 5.atomic_weight =3D 10.811;= string element; string title("\n\t You have selected :\t"); string no= ("\n\t The atomic number for "); string is(" is:\t"); string wgt("\n\t The = atomic weight is:\t");printf ("\t The Begining of the Periodic Table of the= Elements \n");printf ("\t In the hopes of learning C programming and eleme= ntal values. \n\n\n"); do {cout << "\n\t Please enter an Element you would = like to examine : " ;cin >> element;if (element =3D=3D 1.name) { = cout << title << 1.name; cout << no << 1.name << is << 1.atomi= c_no; cout << wgt << 1.atomic_weight; } else if (elem= ent =3D=3D 2.name) { cout << title << 2.name; cout <= < no << 2.name << is << 2.atomic_no; cout << wgt << 2.atomic_wei= ght; } else if (element =3D=3D 3.name) { cout << tit= le << 3.name; cout << no << 3.name << is << 3.atomic_no; = cout << wgt << 3.atomic_weight;} else if (element =3D=3D 3.n= ame) { cout << title << 3.name; cout << no << 3.name= << is << 3.atomic_no; cout << wgt << 3.atomic_weight;} = else if (element =3D=3D 4.name) { cout << title << 4.name; = cout << no << 4.name << is << 4.atomic_no; cout << wgt= << 4.atomic_weight;} else if (element =3D=3D 5.name) { = cout << title << 5.name; cout << no << 5.name << is << 5.ato= mic_no; cout << wgt << 5.atomic_weight;} cout << "\n\= n\t Again Yes/No :"; cin >> x;}while (!strcmp(x,"yes")) ;} _________________________________________________________________ See what you=92re getting into=85before you go there. http://newlivehotmail.com= |
From: Per W. <pw...@ia...> - 2007-07-27 10:06:06
|
But is there a space in the path to the comiler, the header files and the libraries? /pwm On Fri, 27 Jul 2007, wangtao wrote: > I just use the examples under "C:\Dev-Cpp\Examples\Hello",the same error > occurs > > On 7/27/07, Per Westermark <pw...@ia...> wrote: > > > > Have you tried to create a project in a directory path that doesn't > > contain a space? You should always be careful with the use of spaces in > > directory name - quite a lot of development tools are affected! > > > > /pwm > > > > On Fri, 27 Jul 2007, wangtao wrote: > > > > > Hi all, > > > > > > I have newly installed the Dec-C++,I used all the default setups. > > > Then I new a Console Application project and without adding any code > > > line,when I compile it,an error returned: > > > " CreateProcess(C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, > > > C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, ...) failed. " > > > " The system cannot find the file specified. " > > > " D:\Users\atao\Exercise\Dev > > Projects\dev_pro4\Makefile.win" "[Build > > > Error] [main.o] Error 2 " > > > I can not make out what's the problem,would you pls tell me why it is if > > you > > > know? > > > Thanks a lot! > > > > > > -- > > > Kind Regards > > > Tony Wang > > > > > > > > > > -- > Kind Regards > Tony Wang > |
From: wangtao <wan...@gm...> - 2007-07-27 09:26:16
|
I just use the examples under "C:\Dev-Cpp\Examples\Hello",the same error occurs On 7/27/07, Per Westermark <pw...@ia...> wrote: > > Have you tried to create a project in a directory path that doesn't > contain a space? You should always be careful with the use of spaces in > directory name - quite a lot of development tools are affected! > > /pwm > > On Fri, 27 Jul 2007, wangtao wrote: > > > Hi all, > > > > I have newly installed the Dec-C++,I used all the default setups. > > Then I new a Console Application project and without adding any code > > line,when I compile it,an error returned: > > " CreateProcess(C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, > > C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, ...) failed. " > > " The system cannot find the file specified. " > > " D:\Users\atao\Exercise\Dev > Projects\dev_pro4\Makefile.win" "[Build > > Error] [main.o] Error 2 " > > I can not make out what's the problem,would you pls tell me why it is if > you > > know? > > Thanks a lot! > > > > -- > > Kind Regards > > Tony Wang > > > > -- Kind Regards Tony Wang |
From: Per W. <pw...@ia...> - 2007-07-27 09:00:33
|
Have you tried to create a project in a directory path that doesn't contain a space? You should always be careful with the use of spaces in directory name - quite a lot of development tools are affected! /pwm On Fri, 27 Jul 2007, wangtao wrote: > Hi all, > > I have newly installed the Dec-C++,I used all the default setups. > Then I new a Console Application project and without adding any code > line,when I compile it,an error returned: > " CreateProcess(C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, > C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, ...) failed. " > " The system cannot find the file specified. " > " D:\Users\atao\Exercise\Dev Projects\dev_pro4\Makefile.win" "[Build > Error] [main.o] Error 2 " > I can not make out what's the problem,would you pls tell me why it is if you > know? > Thanks a lot! > > -- > Kind Regards > Tony Wang > |
From: wangtao <wan...@gm...> - 2007-07-27 07:48:47
|
Hi all, I have newly installed the Dec-C++,I used all the default setups. Then I new a Console Application project and without adding any code line,when I compile it,an error returned: " CreateProcess(C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, C:\DOCUME~1\vsp\LOCALS~1\Temp\make30042.bat, ...) failed. " " The system cannot find the file specified. " " D:\Users\atao\Exercise\Dev Projects\dev_pro4\Makefile.win" "[Build Error] [main.o] Error 2 " I can not make out what's the problem,would you pls tell me why it is if you know? Thanks a lot! -- Kind Regards Tony Wang |
From: Reid T. <Rei...@at...> - 2007-07-26 13:49:07
|
On Thu, 2007-07-26 at 09:12 -0700, on behalf of Jamiil Abduqadir wrote: > Hey folks, I am looking detail information about Glib::usleep(); the > one provided by the Gtkmm documentation is very skimpy. Does anyone > know where I can get more detail information of this function. > > Thanks! > ------------------------------------------------------------------------- > 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 http://www.koders.com/cpp/fidA4743D9D22BC5EC5C22048BC17C07B86AA8EBEAD.aspx?s=Glib+usleep+Gtkmm see usleep at bottom of page http://svn.gnome.org/viewcvs/glib/trunk/glib/gtimer.c?revision=5279&view=markup see g_usleep |
From: Jamiil A. <jal...@gm...> - 2007-07-26 13:08:16
|
Hey folks, I am looking detail information about Glib::usleep(); the one = provided by the Gtkmm documentation is very skimpy. Does anyone know = where I can get more detail information of this function. Thanks! |
From: Per W. <pw...@ia...> - 2007-07-26 08:25:47
|
Initialize with a constructor: struct check { const int variable; check() variable(2) {} }; /pwm On Thu, 26 Jul 2007, Muhammad Ammar wrote: > Hope everyone is in good health. > > if have a structure like the following > > struct check > { > const int variable; > }; > > than, how to initialize the data member "variable". > > > Best Regards > > Muhammad Ammar > > _________________________________________________________________ > http://im.live.com/messenger/im/home/?source=hmtextlinkjuly07 > > > ------------------------------------------------------------------------- > 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: Jonathan W. <jon...@gm...> - 2007-07-26 07:56:12
|
Hi, You can declare an instance of this struct like this : struct check foo = {42}; If you are mallocing your instances, I'm not sure you can set this value legally This _should_ work though >> Hack << struct check *foo; //malloc, checks, etc *(int *)foo = 42; >> Hack << A safer version would be (still a bit evil though): struct check { const int variable; }; struct check_rw { int variable; }; struct check *foo; //malloc, checks, etc ((struct check_rw *)foo).variable = 42; I may be overlooking an option, though. Regards, Jonathan On 7/26/07, Muhammad Ammar <amm...@ho...> wrote: > > Hope everyone is in good health. > > if have a structure like the following > > struct check > { > const int variable; > }; > > than, how to initialize the data member "variable". > > > Best Regards > > Muhammad Ammar > > _________________________________________________________________ > http://im.live.com/messenger/im/home/?source=hmtextlinkjuly07 > > > ------------------------------------------------------------------------- > 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 > -- <Morpheus> linux, c'est une question de VI ou de MORE |
From: Muhammad A. <amm...@ho...> - 2007-07-26 07:40:27
|
Hope everyone is in good health. if have a structure like the following struct check { const int variable; }; than, how to initialize the data member "variable". Best Regards Muhammad Ammar _________________________________________________________________ http://im.live.com/messenger/im/home/?source=hmtextlinkjuly07 |
From: Jamiil A. <jal...@gm...> - 2007-07-25 12:46:59
|
It's OK Adam, you a are good guy and we all appreciate you impute and the tremendous help you provide to the C++/Dev-Cpp community. I wish you the BEST Adam! ----- Original Message ----- From: "Adam Jones" <aj...@i-...> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" <dev...@li...>; "'matheus ribeiro'" <mfr...@gm...> Sent: Tuesday, July 24, 2007 6:01 PM Subject: RE: [Dev-C++] sleep() for Windows XP > Sorry guys! I was a little too quick! Did not do my homework before > responding. No excuses, but a have a big deadline tomorrow....I will check > myself in the future... > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Jamiil > Abduqadir > Sent: Tuesday, July 24, 2007 10:38 PM > To: 'Dev Cpp MailingLinst'; 'matheus ribeiro' > Subject: Re: [Dev-C++] sleep() for Windows XP > > HEY!! Adam, what is wrong with you man? > We appreciate the time and the effort you put into helping others, but > your > input sounds more like a threat than a suggestion. > Relaaax man!! > ----- Original Message ----- > From: "Adam Jones" <aj...@i-...> > To: "'matheus ribeiro'" <mfr...@gm...> > Cc: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" > <dev...@li...> > Sent: Tuesday, July 24, 2007 8:39 AM > Subject: RE: [Dev-C++] sleep() for Windows XP > > >>>> You Wrote: >>>>But it also eats your cpu cycles... Sleep doest consume CPU. >> >> Please reserve your comments to information that is accurate. You are >> giving >> the wrong information. I don't know any CPU Instruction that does not >> require cpu cycles. >> Sleep() is not some magical command, nor a cpu instruction. It is a >> function >> call just like any other function call. It takes a value (DWORD) and >> returns >> VOID. It's prototype declaration is in windows.h. >> >> If you take the time to investigate you will notice the assembler code >> that >> gets produced when you make this call. Better yet you could have just >> read >> the MSDN entry on microsoft's website and it would have told you how this >> function works. Functionally it works the same way as the function I >> wrote. >> It checks the clock ticks and compares them to see if the require time >> has >> lapse. >> >> The major difference is that my function is platform independent, and it >> does not require preprocessor commands. As you know, windows.h is only >> available on a windows platform. The function I wrote, requires only >> time.h >> which is a c++ library. >> >> I will even take this one step further. If you compile these two >> programs, >> the sizes of the files are the same (16k), and the assembler code that is >> produced is almost Identical. >> >> Program 1: >> //Source code headers >> #include <time.h> >> >> //Main program function >> int main() >> { >> //sleep command >> unsigned int clockTicks; >> clock_t ticksReached; >> >> clockTicks = 3000; >> ticksReached = clockTicks + clock(); >> while (ticksReached > clock()); >> >> >> //Exit program >> return 0; >> } >> >> Program 2: >> >> //Source code headers >> #include <windows.h> >> >> //Main program function >> int main() >> { >> //sleep command >> Sleep(300); >> >> //Exit program >> return 0; >> } >> >> - Adam Jones >> >> >> >> -----Original Message----- >> From: matheus ribeiro [mailto:mfr...@gm...] >> Sent: Tuesday, July 24, 2007 12:32 AM >> To: Adam Jones >> Cc: Jamiil Abduqadir; Dev Cpp MailingLinst >> Subject: Re: [Dev-C++] sleep() for Windows XP >> >> But it also eats your cpu cycles... Sleep doest consume CPU. >> >> 2007/7/23, Adam Jones <aj...@i-...>: >>> Just in case you are interested, here is a platfrom independent way to >> cause >>> your program to sleep without using sleep() or MS version Sleep(). It >>> also >>> avoids preprocessors commands. >>> >>> #include <time.h> >>> >>> Int main() >>> { >>> >>> unsigned int clockTicks; //Stores the >> amount >>> of time you want to pause execution in clock ticks >>> clock_t ticksReached; //Stores the >> amount >>> of clock ticks >>> >>> clockTicks = 3000; //set pause to 3 seconds >>> ticksReached = clockTicks + clock(); //get number of >>> clocks tick since program started then add the addition wait time >>> while (ticksReached > clock()); //loop until current >>> clock >>> ticks equal the ticks needed to wait >>> >>> return 0; >>> } >>> >>> It is more code, but it is platfrom independent and free of preprocessor >>> commands..... >>> >>> -Adam Jones >>> >>> >>> -----Original Message----- >>> From: dev...@li... >>> [mailto:dev...@li...] On Behalf Of Adam >> Jones >>> Sent: Monday, July 23, 2007 10:24 PM >>> To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' >>> Subject: Re: [Dev-C++] sleep() for Windows XP >>> >>> >>You wrote: >>> >> Does anyone know where I can find a source code for such service, so >> that >>> it is a portable sleep() function? >>> >>> Why do you feel the need to cause your program to sleep(). There may be >>> other ways of pausing executive without using a platform dependent >> command. >>> Or using #defines. If you could provide more details, that may be >>> helpful. >>> >>> -Adam Jones >>> >>> From: dev...@li... >>> [mailto:dev...@li...] On Behalf Of Jamiil >>> Abduqadir >>> Sent: Monday, July 23, 2007 3:37 PM >>> To: Dev Cpp MailingLinst >>> Subject: [Dev-C++] sleep() for Windows XP >>> >>> Using GCC, I developed some small apps under Linux, now I am trying to >> port >>> this apps to MSWinXP, but there are some Unix functions that are not >>> availableunder MS, sleep() is one of them. Does anyone know where I can >>> find a source code for such service, so that it isa portable sleep() >>> function? >>> >>> >>> >>> ------------------------------------------------------------------------- >>> 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 >>> >>> >>> ------------------------------------------------------------------------- >>> 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 >>> >> > > > ------------------------------------------------------------------------- > 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-07-25 01:01:54
|
Sorry guys! I was a little too quick! Did not do my homework before responding. No excuses, but a have a big deadline tomorrow....I will check myself in the future... -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Tuesday, July 24, 2007 10:38 PM To: 'Dev Cpp MailingLinst'; 'matheus ribeiro' Subject: Re: [Dev-C++] sleep() for Windows XP HEY!! Adam, what is wrong with you man? We appreciate the time and the effort you put into helping others, but your input sounds more like a threat than a suggestion. Relaaax man!! ----- Original Message ----- From: "Adam Jones" <aj...@i-...> To: "'matheus ribeiro'" <mfr...@gm...> Cc: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" <dev...@li...> Sent: Tuesday, July 24, 2007 8:39 AM Subject: RE: [Dev-C++] sleep() for Windows XP >>> You Wrote: >>>But it also eats your cpu cycles... Sleep doest consume CPU. > > Please reserve your comments to information that is accurate. You are > giving > the wrong information. I don't know any CPU Instruction that does not > require cpu cycles. > Sleep() is not some magical command, nor a cpu instruction. It is a > function > call just like any other function call. It takes a value (DWORD) and > returns > VOID. It's prototype declaration is in windows.h. > > If you take the time to investigate you will notice the assembler code > that > gets produced when you make this call. Better yet you could have just read > the MSDN entry on microsoft's website and it would have told you how this > function works. Functionally it works the same way as the function I > wrote. > It checks the clock ticks and compares them to see if the require time has > lapse. > > The major difference is that my function is platform independent, and it > does not require preprocessor commands. As you know, windows.h is only > available on a windows platform. The function I wrote, requires only > time.h > which is a c++ library. > > I will even take this one step further. If you compile these two programs, > the sizes of the files are the same (16k), and the assembler code that is > produced is almost Identical. > > Program 1: > //Source code headers > #include <time.h> > > //Main program function > int main() > { > //sleep command > unsigned int clockTicks; > clock_t ticksReached; > > clockTicks = 3000; > ticksReached = clockTicks + clock(); > while (ticksReached > clock()); > > > //Exit program > return 0; > } > > Program 2: > > //Source code headers > #include <windows.h> > > //Main program function > int main() > { > //sleep command > Sleep(300); > > //Exit program > return 0; > } > > - Adam Jones > > > > -----Original Message----- > From: matheus ribeiro [mailto:mfr...@gm...] > Sent: Tuesday, July 24, 2007 12:32 AM > To: Adam Jones > Cc: Jamiil Abduqadir; Dev Cpp MailingLinst > Subject: Re: [Dev-C++] sleep() for Windows XP > > But it also eats your cpu cycles... Sleep doest consume CPU. > > 2007/7/23, Adam Jones <aj...@i-...>: >> Just in case you are interested, here is a platfrom independent way to > cause >> your program to sleep without using sleep() or MS version Sleep(). It >> also >> avoids preprocessors commands. >> >> #include <time.h> >> >> Int main() >> { >> >> unsigned int clockTicks; //Stores the > amount >> of time you want to pause execution in clock ticks >> clock_t ticksReached; //Stores the > amount >> of clock ticks >> >> clockTicks = 3000; //set pause to 3 seconds >> ticksReached = clockTicks + clock(); //get number of >> clocks tick since program started then add the addition wait time >> while (ticksReached > clock()); //loop until current >> clock >> ticks equal the ticks needed to wait >> >> return 0; >> } >> >> It is more code, but it is platfrom independent and free of preprocessor >> commands..... >> >> -Adam Jones >> >> >> -----Original Message----- >> From: dev...@li... >> [mailto:dev...@li...] On Behalf Of Adam > Jones >> Sent: Monday, July 23, 2007 10:24 PM >> To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' >> Subject: Re: [Dev-C++] sleep() for Windows XP >> >> >>You wrote: >> >> Does anyone know where I can find a source code for such service, so > that >> it is a portable sleep() function? >> >> Why do you feel the need to cause your program to sleep(). There may be >> other ways of pausing executive without using a platform dependent > command. >> Or using #defines. If you could provide more details, that may be >> helpful. >> >> -Adam Jones >> >> From: dev...@li... >> [mailto:dev...@li...] On Behalf Of Jamiil >> Abduqadir >> Sent: Monday, July 23, 2007 3:37 PM >> To: Dev Cpp MailingLinst >> Subject: [Dev-C++] sleep() for Windows XP >> >> Using GCC, I developed some small apps under Linux, now I am trying to > port >> this apps to MSWinXP, but there are some Unix functions that are not >> availableunder MS, sleep() is one of them. Does anyone know where I can >> find a source code for such service, so that it isa portable sleep() >> function? >> >> >> >> ------------------------------------------------------------------------- >> 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 >> >> >> ------------------------------------------------------------------------- >> 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 >> > ------------------------------------------------------------------------- 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: Jamiil A. <jal...@gm...> - 2007-07-24 23:34:55
|
HEY!! Adam, what is wrong with you man? We appreciate the time and the effort you put into helping others, but your input sounds more like a threat than a suggestion. Relaaax man!! ----- Original Message ----- From: "Adam Jones" <aj...@i-...> To: "'matheus ribeiro'" <mfr...@gm...> Cc: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" <dev...@li...> Sent: Tuesday, July 24, 2007 8:39 AM Subject: RE: [Dev-C++] sleep() for Windows XP >>> You Wrote: >>>But it also eats your cpu cycles... Sleep doest consume CPU. > > Please reserve your comments to information that is accurate. You are > giving > the wrong information. I don't know any CPU Instruction that does not > require cpu cycles. > Sleep() is not some magical command, nor a cpu instruction. It is a > function > call just like any other function call. It takes a value (DWORD) and > returns > VOID. It's prototype declaration is in windows.h. > > If you take the time to investigate you will notice the assembler code > that > gets produced when you make this call. Better yet you could have just read > the MSDN entry on microsoft's website and it would have told you how this > function works. Functionally it works the same way as the function I > wrote. > It checks the clock ticks and compares them to see if the require time has > lapse. > > The major difference is that my function is platform independent, and it > does not require preprocessor commands. As you know, windows.h is only > available on a windows platform. The function I wrote, requires only > time.h > which is a c++ library. > > I will even take this one step further. If you compile these two programs, > the sizes of the files are the same (16k), and the assembler code that is > produced is almost Identical. > > Program 1: > //Source code headers > #include <time.h> > > //Main program function > int main() > { > //sleep command > unsigned int clockTicks; > clock_t ticksReached; > > clockTicks = 3000; > ticksReached = clockTicks + clock(); > while (ticksReached > clock()); > > > //Exit program > return 0; > } > > Program 2: > > //Source code headers > #include <windows.h> > > //Main program function > int main() > { > //sleep command > Sleep(300); > > //Exit program > return 0; > } > > - Adam Jones > > > > -----Original Message----- > From: matheus ribeiro [mailto:mfr...@gm...] > Sent: Tuesday, July 24, 2007 12:32 AM > To: Adam Jones > Cc: Jamiil Abduqadir; Dev Cpp MailingLinst > Subject: Re: [Dev-C++] sleep() for Windows XP > > But it also eats your cpu cycles... Sleep doest consume CPU. > > 2007/7/23, Adam Jones <aj...@i-...>: >> Just in case you are interested, here is a platfrom independent way to > cause >> your program to sleep without using sleep() or MS version Sleep(). It >> also >> avoids preprocessors commands. >> >> #include <time.h> >> >> Int main() >> { >> >> unsigned int clockTicks; //Stores the > amount >> of time you want to pause execution in clock ticks >> clock_t ticksReached; //Stores the > amount >> of clock ticks >> >> clockTicks = 3000; //set pause to 3 seconds >> ticksReached = clockTicks + clock(); //get number of >> clocks tick since program started then add the addition wait time >> while (ticksReached > clock()); //loop until current >> clock >> ticks equal the ticks needed to wait >> >> return 0; >> } >> >> It is more code, but it is platfrom independent and free of preprocessor >> commands..... >> >> -Adam Jones >> >> >> -----Original Message----- >> From: dev...@li... >> [mailto:dev...@li...] On Behalf Of Adam > Jones >> Sent: Monday, July 23, 2007 10:24 PM >> To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' >> Subject: Re: [Dev-C++] sleep() for Windows XP >> >> >>You wrote: >> >> Does anyone know where I can find a source code for such service, so > that >> it is a portable sleep() function? >> >> Why do you feel the need to cause your program to sleep(). There may be >> other ways of pausing executive without using a platform dependent > command. >> Or using #defines. If you could provide more details, that may be >> helpful. >> >> -Adam Jones >> >> From: dev...@li... >> [mailto:dev...@li...] On Behalf Of Jamiil >> Abduqadir >> Sent: Monday, July 23, 2007 3:37 PM >> To: Dev Cpp MailingLinst >> Subject: [Dev-C++] sleep() for Windows XP >> >> Using GCC, I developed some small apps under Linux, now I am trying to > port >> this apps to MSWinXP, but there are some Unix functions that are not >> availableunder MS, sleep() is one of them. Does anyone know where I can >> find a source code for such service, so that it isa portable sleep() >> function? >> >> >> >> ------------------------------------------------------------------------- >> 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 >> >> >> ------------------------------------------------------------------------- >> 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-07-24 18:30:17
|
You are correct! I went to the documentation myself and I was incorrect. For that I apologizes for giving incorrect information. The thread is suspend, and then it is awaken by the operating system. Sorry for the wrong information..... -----Original Message----- From: Per Westermark [mailto:pw...@ia...] Sent: Tuesday, July 24, 2007 11:52 AM To: Adam Jones Cc: 'matheus ribeiro'; 'Dev Cpp MailingLinst' Subject: Re: [Dev-C++] sleep() for Windows XP Not really correct. The Sleep() call does not busy-loop. It suspends the current thread to allow other threads to run for the delay duration. This is the description for the dwMilliseconds parameter to Sleep(). "Specifies the time, in milliseconds, for which to suspend execution. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of INFINITE causes an infinite delay." This is easy to test by writing a miniature program with a Sleep(60000) - the program will terminate after one minute, but during this time the Task Manager will show that it doesn't consume any processor time. /pwm On Tue, 24 Jul 2007, Adam Jones wrote: > >> You Wrote: > >>But it also eats your cpu cycles... Sleep doest consume CPU. > > Please reserve your comments to information that is accurate. You are giving > the wrong information. I don't know any CPU Instruction that does not > require cpu cycles. > Sleep() is not some magical command, nor a cpu instruction. It is a function > call just like any other function call. It takes a value (DWORD) and returns > VOID. It's prototype declaration is in windows.h. > > If you take the time to investigate you will notice the assembler code that > gets produced when you make this call. Better yet you could have just read > the MSDN entry on microsoft's website and it would have told you how this > function works. Functionally it works the same way as the function I wrote. > It checks the clock ticks and compares them to see if the require time has > lapse. > > The major difference is that my function is platform independent, and it > does not require preprocessor commands. As you know, windows.h is only > available on a windows platform. The function I wrote, requires only time.h > which is a c++ library. > > I will even take this one step further. If you compile these two programs, > the sizes of the files are the same (16k), and the assembler code that is > produced is almost Identical. > > Program 1: > //Source code headers > #include <time.h> > > //Main program function > int main() > { > //sleep command > unsigned int clockTicks; > clock_t ticksReached; > > clockTicks = 3000; > ticksReached = clockTicks + clock(); > while (ticksReached > clock()); > > > //Exit program > return 0; > } > > Program 2: > > //Source code headers > #include <windows.h> > > //Main program function > int main() > { > //sleep command > Sleep(300); > > //Exit program > return 0; > } > > - Adam Jones > > > > -----Original Message----- > From: matheus ribeiro [mailto:mfr...@gm...] > Sent: Tuesday, July 24, 2007 12:32 AM > To: Adam Jones > Cc: Jamiil Abduqadir; Dev Cpp MailingLinst > Subject: Re: [Dev-C++] sleep() for Windows XP > > But it also eats your cpu cycles... Sleep doest consume CPU. > > 2007/7/23, Adam Jones <aj...@i-...>: > > Just in case you are interested, here is a platfrom independent way to > cause > > your program to sleep without using sleep() or MS version Sleep(). It also > > avoids preprocessors commands. > > > > #include <time.h> > > > > Int main() > > { > > > > unsigned int clockTicks; //Stores the > amount > > of time you want to pause execution in clock ticks > > clock_t ticksReached; //Stores the > amount > > of clock ticks > > > > clockTicks = 3000; //set pause to 3 seconds > > ticksReached = clockTicks + clock(); //get number of > > clocks tick since program started then add the addition wait time > > while (ticksReached > clock()); //loop until current clock > > ticks equal the ticks needed to wait > > > > return 0; > > } > > > > It is more code, but it is platfrom independent and free of preprocessor > > commands..... > > > > -Adam Jones > > > > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf Of Adam > Jones > > Sent: Monday, July 23, 2007 10:24 PM > > To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' > > Subject: Re: [Dev-C++] sleep() for Windows XP > > > > >>You wrote: > > >> Does anyone know where I can find a source code for such service, so > that > > it is a portable sleep() function? > > > > Why do you feel the need to cause your program to sleep(). There may be > > other ways of pausing executive without using a platform dependent > command. > > Or using #defines. If you could provide more details, that may be helpful. > > > > -Adam Jones > > > > From: dev...@li... > > [mailto:dev...@li...] On Behalf Of Jamiil > > Abduqadir > > Sent: Monday, July 23, 2007 3:37 PM > > To: Dev Cpp MailingLinst > > Subject: [Dev-C++] sleep() for Windows XP > > > > Using GCC, I developed some small apps under Linux, now I am trying to > port > > this apps to MSWinXP, but there are some Unix functions that are not > > availableunder MS, sleep() is one of them. Does anyone know where I can > > find a source code for such service, so that it isa portable sleep() > > function? > > > > > > > > ------------------------------------------------------------------------- > > 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 > > > > > > ------------------------------------------------------------------------- > > 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 > > > > > ------------------------------------------------------------------------- > 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: matheus r. <mfr...@gm...> - 2007-07-24 16:17:46
|
My information is not incorrect. Sleep does indeed sleeps, being waked by an interrupt. Its not a busy wait loop. You can check that by making your function call and using Sleep call. Check processor usage and tell us your results. 2007/7/24, Adam Jones <aj...@i-...>: > >> You Wrote: > >>But it also eats your cpu cycles... Sleep doest consume CPU. > > Please reserve your comments to information that is accurate. You are giving > the wrong information. I don't know any CPU Instruction that does not > require cpu cycles. > Sleep() is not some magical command, nor a cpu instruction. It is a function > call just like any other function call. It takes a value (DWORD) and returns > VOID. It's prototype declaration is in windows.h. > > If you take the time to investigate you will notice the assembler code that > gets produced when you make this call. Better yet you could have just read > the MSDN entry on microsoft's website and it would have told you how this > function works. Functionally it works the same way as the function I wrote. > It checks the clock ticks and compares them to see if the require time has > lapse. > > The major difference is that my function is platform independent, and it > does not require preprocessor commands. As you know, windows.h is only > available on a windows platform. The function I wrote, requires only time.h > which is a c++ library. > > I will even take this one step further. If you compile these two programs, > the sizes of the files are the same (16k), and the assembler code that is > produced is almost Identical. > > Program 1: > //Source code headers > #include <time.h> > > //Main program function > int main() > { > //sleep command > unsigned int clockTicks; > clock_t ticksReached; > > clockTicks = 3000; > ticksReached = clockTicks + clock(); > while (ticksReached > clock()); > > > //Exit program > return 0; > } > > Program 2: > > //Source code headers > #include <windows.h> > > //Main program function > int main() > { > //sleep command > Sleep(300); > > //Exit program > return 0; > } > > - Adam Jones > > > > -----Original Message----- > From: matheus ribeiro [mailto:mfr...@gm...] > Sent: Tuesday, July 24, 2007 12:32 AM > To: Adam Jones > Cc: Jamiil Abduqadir; Dev Cpp MailingLinst > Subject: Re: [Dev-C++] sleep() for Windows XP > > But it also eats your cpu cycles... Sleep doest consume CPU. > > 2007/7/23, Adam Jones <aj...@i-...>: > > Just in case you are interested, here is a platfrom independent way to > cause > > your program to sleep without using sleep() or MS version Sleep(). It also > > avoids preprocessors commands. > > > > #include <time.h> > > > > Int main() > > { > > > > unsigned int clockTicks; //Stores the > amount > > of time you want to pause execution in clock ticks > > clock_t ticksReached; //Stores the > amount > > of clock ticks > > > > clockTicks = 3000; //set pause to 3 seconds > > ticksReached = clockTicks + clock(); //get number of > > clocks tick since program started then add the addition wait time > > while (ticksReached > clock()); //loop until current clock > > ticks equal the ticks needed to wait > > > > return 0; > > } > > > > It is more code, but it is platfrom independent and free of preprocessor > > commands..... > > > > -Adam Jones > > > > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf Of Adam > Jones > > Sent: Monday, July 23, 2007 10:24 PM > > To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' > > Subject: Re: [Dev-C++] sleep() for Windows XP > > > > >>You wrote: > > >> Does anyone know where I can find a source code for such service, so > that > > it is a portable sleep() function? > > > > Why do you feel the need to cause your program to sleep(). There may be > > other ways of pausing executive without using a platform dependent > command. > > Or using #defines. If you could provide more details, that may be helpful. > > > > -Adam Jones > > > > From: dev...@li... > > [mailto:dev...@li...] On Behalf Of Jamiil > > Abduqadir > > Sent: Monday, July 23, 2007 3:37 PM > > To: Dev Cpp MailingLinst > > Subject: [Dev-C++] sleep() for Windows XP > > > > Using GCC, I developed some small apps under Linux, now I am trying to > port > > this apps to MSWinXP, but there are some Unix functions that are not > > availableunder MS, sleep() is one of them. Does anyone know where I can > > find a source code for such service, so that it isa portable sleep() > > function? > > > > > > > > ------------------------------------------------------------------------- > > 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 > > > > > > ------------------------------------------------------------------------- > > 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: Per W. <pw...@ia...> - 2007-07-24 15:52:03
|
Not really correct. The Sleep() call does not busy-loop. It suspends the current thread to allow other threads to run for the delay duration. This is the description for the dwMilliseconds parameter to Sleep(). "Specifies the time, in milliseconds, for which to suspend execution. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of INFINITE causes an infinite delay." This is easy to test by writing a miniature program with a Sleep(60000) - the program will terminate after one minute, but during this time the Task Manager will show that it doesn't consume any processor time. /pwm On Tue, 24 Jul 2007, Adam Jones wrote: > >> You Wrote: > >>But it also eats your cpu cycles... Sleep doest consume CPU. > > Please reserve your comments to information that is accurate. You are giving > the wrong information. I don't know any CPU Instruction that does not > require cpu cycles. > Sleep() is not some magical command, nor a cpu instruction. It is a function > call just like any other function call. It takes a value (DWORD) and returns > VOID. It's prototype declaration is in windows.h. > > If you take the time to investigate you will notice the assembler code that > gets produced when you make this call. Better yet you could have just read > the MSDN entry on microsoft's website and it would have told you how this > function works. Functionally it works the same way as the function I wrote. > It checks the clock ticks and compares them to see if the require time has > lapse. > > The major difference is that my function is platform independent, and it > does not require preprocessor commands. As you know, windows.h is only > available on a windows platform. The function I wrote, requires only time.h > which is a c++ library. > > I will even take this one step further. If you compile these two programs, > the sizes of the files are the same (16k), and the assembler code that is > produced is almost Identical. > > Program 1: > //Source code headers > #include <time.h> > > //Main program function > int main() > { > //sleep command > unsigned int clockTicks; > clock_t ticksReached; > > clockTicks = 3000; > ticksReached = clockTicks + clock(); > while (ticksReached > clock()); > > > //Exit program > return 0; > } > > Program 2: > > //Source code headers > #include <windows.h> > > //Main program function > int main() > { > //sleep command > Sleep(300); > > //Exit program > return 0; > } > > - Adam Jones > > > > -----Original Message----- > From: matheus ribeiro [mailto:mfr...@gm...] > Sent: Tuesday, July 24, 2007 12:32 AM > To: Adam Jones > Cc: Jamiil Abduqadir; Dev Cpp MailingLinst > Subject: Re: [Dev-C++] sleep() for Windows XP > > But it also eats your cpu cycles... Sleep doest consume CPU. > > 2007/7/23, Adam Jones <aj...@i-...>: > > Just in case you are interested, here is a platfrom independent way to > cause > > your program to sleep without using sleep() or MS version Sleep(). It also > > avoids preprocessors commands. > > > > #include <time.h> > > > > Int main() > > { > > > > unsigned int clockTicks; //Stores the > amount > > of time you want to pause execution in clock ticks > > clock_t ticksReached; //Stores the > amount > > of clock ticks > > > > clockTicks = 3000; //set pause to 3 seconds > > ticksReached = clockTicks + clock(); //get number of > > clocks tick since program started then add the addition wait time > > while (ticksReached > clock()); //loop until current clock > > ticks equal the ticks needed to wait > > > > return 0; > > } > > > > It is more code, but it is platfrom independent and free of preprocessor > > commands..... > > > > -Adam Jones > > > > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf Of Adam > Jones > > Sent: Monday, July 23, 2007 10:24 PM > > To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' > > Subject: Re: [Dev-C++] sleep() for Windows XP > > > > >>You wrote: > > >> Does anyone know where I can find a source code for such service, so > that > > it is a portable sleep() function? > > > > Why do you feel the need to cause your program to sleep(). There may be > > other ways of pausing executive without using a platform dependent > command. > > Or using #defines. If you could provide more details, that may be helpful. > > > > -Adam Jones > > > > From: dev...@li... > > [mailto:dev...@li...] On Behalf Of Jamiil > > Abduqadir > > Sent: Monday, July 23, 2007 3:37 PM > > To: Dev Cpp MailingLinst > > Subject: [Dev-C++] sleep() for Windows XP > > > > Using GCC, I developed some small apps under Linux, now I am trying to > port > > this apps to MSWinXP, but there are some Unix functions that are not > > availableunder MS, sleep() is one of them. Does anyone know where I can > > find a source code for such service, so that it isa portable sleep() > > function? > > > > > > > > ------------------------------------------------------------------------- > > 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 > > > > > > ------------------------------------------------------------------------- > > 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 > > > > > ------------------------------------------------------------------------- > 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-07-24 15:39:43
|
>> You Wrote: >>But it also eats your cpu cycles... Sleep doest consume CPU. Please reserve your comments to information that is accurate. You are giving the wrong information. I don't know any CPU Instruction that does not require cpu cycles. Sleep() is not some magical command, nor a cpu instruction. It is a function call just like any other function call. It takes a value (DWORD) and returns VOID. It's prototype declaration is in windows.h. If you take the time to investigate you will notice the assembler code that gets produced when you make this call. Better yet you could have just read the MSDN entry on microsoft's website and it would have told you how this function works. Functionally it works the same way as the function I wrote. It checks the clock ticks and compares them to see if the require time has lapse. The major difference is that my function is platform independent, and it does not require preprocessor commands. As you know, windows.h is only available on a windows platform. The function I wrote, requires only time.h which is a c++ library. I will even take this one step further. If you compile these two programs, the sizes of the files are the same (16k), and the assembler code that is produced is almost Identical. Program 1: //Source code headers #include <time.h> //Main program function int main() { //sleep command unsigned int clockTicks; clock_t ticksReached; clockTicks = 3000; ticksReached = clockTicks + clock(); while (ticksReached > clock()); //Exit program return 0; } Program 2: //Source code headers #include <windows.h> //Main program function int main() { //sleep command Sleep(300); //Exit program return 0; } - Adam Jones -----Original Message----- From: matheus ribeiro [mailto:mfr...@gm...] Sent: Tuesday, July 24, 2007 12:32 AM To: Adam Jones Cc: Jamiil Abduqadir; Dev Cpp MailingLinst Subject: Re: [Dev-C++] sleep() for Windows XP But it also eats your cpu cycles... Sleep doest consume CPU. 2007/7/23, Adam Jones <aj...@i-...>: > Just in case you are interested, here is a platfrom independent way to cause > your program to sleep without using sleep() or MS version Sleep(). It also > avoids preprocessors commands. > > #include <time.h> > > Int main() > { > > unsigned int clockTicks; //Stores the amount > of time you want to pause execution in clock ticks > clock_t ticksReached; //Stores the amount > of clock ticks > > clockTicks = 3000; //set pause to 3 seconds > ticksReached = clockTicks + clock(); //get number of > clocks tick since program started then add the addition wait time > while (ticksReached > clock()); //loop until current clock > ticks equal the ticks needed to wait > > return 0; > } > > It is more code, but it is platfrom independent and free of preprocessor > commands..... > > -Adam Jones > > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Adam Jones > Sent: Monday, July 23, 2007 10:24 PM > To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' > Subject: Re: [Dev-C++] sleep() for Windows XP > > >>You wrote: > >> Does anyone know where I can find a source code for such service, so that > it is a portable sleep() function? > > Why do you feel the need to cause your program to sleep(). There may be > other ways of pausing executive without using a platform dependent command. > Or using #defines. If you could provide more details, that may be helpful. > > -Adam Jones > > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Jamiil > Abduqadir > Sent: Monday, July 23, 2007 3:37 PM > To: Dev Cpp MailingLinst > Subject: [Dev-C++] sleep() for Windows XP > > Using GCC, I developed some small apps under Linux, now I am trying to port > this apps to MSWinXP, but there are some Unix functions that are not > availableunder MS, sleep() is one of them. Does anyone know where I can > find a source code for such service, so that it isa portable sleep() > function? > > > > ------------------------------------------------------------------------- > 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 > > > ------------------------------------------------------------------------- > 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: matheus r. <mfr...@gm...> - 2007-07-24 04:32:42
|
But it also eats your cpu cycles... Sleep doest consume CPU. 2007/7/23, Adam Jones <aj...@i-...>: > Just in case you are interested, here is a platfrom independent way to cause > your program to sleep without using sleep() or MS version Sleep(). It also > avoids preprocessors commands. > > #include <time.h> > > Int main() > { > > unsigned int clockTicks; //Stores the amount > of time you want to pause execution in clock ticks > clock_t ticksReached; //Stores the amount > of clock ticks > > clockTicks = 3000; //set pause to 3 seconds > ticksReached = clockTicks + clock(); //get number of > clocks tick since program started then add the addition wait time > while (ticksReached > clock()); //loop until current clock > ticks equal the ticks needed to wait > > return 0; > } > > It is more code, but it is platfrom independent and free of preprocessor > commands..... > > -Adam Jones > > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Adam Jones > Sent: Monday, July 23, 2007 10:24 PM > To: 'Jamiil Abduqadir'; 'Dev Cpp MailingLinst' > Subject: Re: [Dev-C++] sleep() for Windows XP > > >>You wrote: > >> Does anyone know where I can find a source code for such service, so that > it is a portable sleep() function? > > Why do you feel the need to cause your program to sleep(). There may be > other ways of pausing executive without using a platform dependent command. > Or using #defines. If you could provide more details, that may be helpful. > > -Adam Jones > > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Jamiil > Abduqadir > Sent: Monday, July 23, 2007 3:37 PM > To: Dev Cpp MailingLinst > Subject: [Dev-C++] sleep() for Windows XP > > Using GCC, I developed some small apps under Linux, now I am trying to port > this apps to MSWinXP, but there are some Unix functions that are not > availableunder MS, sleep() is one of them. Does anyone know where I can > find a source code for such service, so that it isa portable sleep() > function? > > > > ------------------------------------------------------------------------- > 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 > > > ------------------------------------------------------------------------- > 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 > |