dev-cpp-users Mailing List for Dev-C++ (Page 56)
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: Jamiil A. <jal...@gm...> - 2007-07-21 18:06:02
|
Well, I would like to give you more information, but my problem is that I don't know how to utilize Dev-Cpp's debugger to locate the problem. If you know a trick to catch the problemed code, please let me know. Thanks in advance. ----- Original Message ----- From: "Adam Jones" <aj...@i-...> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" <dev...@li...> Sent: Saturday, July 21, 2007 5:47 AM Subject: RE: [Dev-C++] Segmentation Fault - Debugging You Wrote: > I have a segmentation fault in my program This usually indicates a pointer allocation problem. Check your pointers in your program. Make sure they are allocated and initialized correctly before using them. Without out knowing more about the code or what you are doing, this is the only advice I can give at this point. -Adam Jones From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Saturday, July 21, 2007 10:37 AM To: Dev Cpp MailingLinst Subject: [Dev-C++] Segmentation Fault - Debugging Hello. I have a segmentation fault in my program, I know that I could trace, or back trace in this case, to find where the the segmentation fault occures. What I don't know, though, how to do it. Can someone please point me out where I can get this information, or tell how to do it under Dev-Cpp? Thanks everyone. |
From: Hiroyuki Y. <yam...@gm...> - 2007-07-21 15:22:50
|
Hi, I'm wondering how you would write a method returning a string. In C, we usually return char * which malloced in the function or returning char * which is static in the function. (We should free the char * in the first case.) In C++, we have std::string, so i'm not sure what to do with it to return string. What I'm trying to do as following. 1. use char * as a return value just like C 2. use std::string as a return value (copying the string object) 3. use std::string reference as one of the arguments (return value is bool or something.) 4. use std::string reference as a return value There should be more ways, but I'm not familier with those (teach me those please) and I don't know what's the best. I'm going to use method 2 because it's simple and copying string object is not a much cost I think. (It's said that string object is 7 times as big as the pointer size(4bytes) at the biggest in Effective STL) Please let me know how you would write to return string. Thanks, HIroyuki Yamada |
From: Adam J. <aj...@i-...> - 2007-07-21 13:02:57
|
>>You wrote: >>every output is equal to 0. I can't solve how to make the count of the vocals and conconant. Do you have a solution Please make sure your code looks like this, and it should work. #include <iostream> #include <ctype.h> using namespace std; int main() { char ch; int aCnt =0, eCnt =0, iCnt =0, oCnt =0, uCnt =0, consonantCnt =0, spaceCnt =0; while ( cin >> ch ) { <- Note where I added the brackets one here.... switch ( ch ) { case 'a': case 'A': ++aCnt; break; case 'e': case 'E': ++eCnt; break; case 'i': case 'I': ++iCnt; break; case 'o': case 'O': ++oCnt; break; case 'u': case 'U': ++uCnt; break; case ' ': ++spaceCnt; default: if ( isalpha( ch )) ++consonantCnt; break; } cout << " numero di a:" << aCnt << '\n'; cout << " numero di e:" << eCnt << '\n'; cout << " numero di i:" << iCnt << '\n'; cout << " numero di o:" << oCnt << '\n'; cout << " numero di u:" << uCnt << '\n'; cout << " numero di consonanti:" << consonantCnt << '\n'; cout << " numero di sapzi:" << spaceCnt << '\n'; } <- The other bracket here..... return 0; } -Adam Jones CONFIDENTIALITY NOTE: This e-mail and its attachments contain confidential information and are intended solely for the use of the individual(s) named on this transmission. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you are not the intended recipient of this e-mail please destroy this message immediately and advise the sender of the same. -----Original Message----- From: dan...@li... [mailto:dan...@li...] Sent: Friday, July 20, 2007 8:47 AM To: ajones Subject: Re: [Dev-C++] Question I put the bracket as you said, and i solved the problem. Now appers another one: with this initialization int aCnt =0, eCnt =0, iCnt =0, oCnt =0, uCnt =0, consonantCnt =0, spaceCnt =0; every output is equal to 0. I can't solve how to make the count of the vocals and conconant. Do you have a solution Thanks Danilo ---------- Initial Header ----------- >From : dev...@li... To : "dev-c++ devc++" dev...@li... Cc : Date : Thu, 19 Jul 2007 18:33:01 -0400 Subject : Re: [Dev-C++] Question > The code you posted is listed below: > > >>#include <iostream> > >>#include <ctype.h> > >>using namespace std; > >>int main() > >>{ > >> char ch; > >> int aCnt =0, eCnt =0, iCnt =0, oCnt =0, uCnt =0, consonantCnt =0, > spaceCnt =0; > >> while ( cin >> ch ) > >> switch ( ch ) > >> { > >> case 'a': case 'A': > >> ++aCnt; > >> break; > >> case 'e': case 'E': > >> ++eCnt; > >> break; > >> case 'i': case 'I': > >> ++iCnt; > >> break; > >> case 'o': case 'O': > >> ++oCnt; > >> break; > >> case 'u': case 'U': > >> ++uCnt; > >> break; > >> case ' ': > >> ++spaceCnt; > >> default: > >> if ( isalpha( ch )) > >> ++consonantCnt; > >> break; > >> } > >> cout << " numero di a:" << aCnt << '\n'; > >> cout << " numero di e:" << eCnt << '\n'; > >> cout << " numero di i:" << iCnt << '\n'; > >> cout << " numero di o:" << oCnt << '\n'; > >> cout << " numero di u:" << uCnt << '\n'; > >> cout << " numero di consonanti:" << consonantCnt << '\n'; > >> cout << " numero di sapzi:" << spaceCnt << '\n'; > >> return 0; > >>} > > The problem with your code is that you do not enclose the switch statement > inside of your while loop. So what is happing is that the only line in your > program being executed is > > >> while ( cin >> ch ) > > You need to add the brackets after the while loop and enclose the switch > statement. Once you do that, it should work, > > while ( cin >> ch ) > { <--Add this openning bracket here > switch ( ch ) > { > case 'a': case 'A': > . > . > . > . > } <-- Add closing bracket here. > > -Adam Jones > > -----Original Message----- > From: dan...@li... [mailto:dan...@li...] > Sent: Thursday, July 19, 2007 9:57 AM > To: ajones > Subject: Re: [Dev-C++] Question > > This is the source code > > many thanks > > Danilo > > ---------- Initial Header ----------- > > >From : dev...@li... > To : "dev-c++ devc++" dev...@li... > Cc : > Date : Thu, 19 Jul 2007 08:59:23 -0400 > Subject : Re: [Dev-C++] Question > > > > > > > > > >>Hello, > > > > >>I have a problem with this program: when a give the execute comand > > >>the > > *.exe window opens but after I give the characters to switch as You > > can see on the While comand : >>while ( cin >> ch ) I can't make the > > execution of the program. > > > > >>There's a specific comand to give on the *.exe window for running > > >>the > > execution after writing on it? > > > > >>Many Thanks > > > > >>Danilo > > > > Unfortunately I am not sure what you are asking. If the program is not > > large, post the source code. How do you know that the code is not > running?? > > Maybe it is running, but you haven't paused executive so you can see > > the output. If you don't pause the executive the cin will get the > > input, the program will do what it has to do and then close the console > window. > > > > -Adam Jones > > > > > > > > ---------------------------------------------------------------------- > > --- This SF.net email is sponsored by DB2 Express Download DB2 Express > > C - the FREE version of DB2 express and take control of your XML. No > > limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > 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 > > > > > ------------------------------------------------------ > Leggi GRATIS le tue mail con il telefonino i-modeT di Wind > http://i-mode.wind.it/ > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > 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 > ------------------------------------------------------ Scegli infostrada: ADSL gratis per tutta l'estate e telefoni senza canone Telecom http://click.libero.it/infostrada |
From: Adam J. <aj...@i-...> - 2007-07-21 12:47:14
|
You Wrote: > I have a segmentation fault in my program This usually indicates a pointer allocation problem. Check your pointers = in your program. Make sure they are allocated and initialized correctly = before using them. Without out knowing more about the code or what you are = doing, this is the only advice I can give at this point. -Adam Jones From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Saturday, July 21, 2007 10:37 AM To: Dev Cpp MailingLinst Subject: [Dev-C++] Segmentation Fault - Debugging Hello. I have a segmentation fault in my program, I know that I could trace, or back trace in this case, to find where the the segmentation fault = occures. What I don't know, though, how to do it. Can someone please point me out where I can get this information, or = tell how to do it under Dev-Cpp? =A0 Thanks everyone. |
From: Jamiil A. <jal...@gm...> - 2007-07-21 11:33:27
|
Hello. I have a segmentation fault in my program, I know that I could trace, or = back trace in this case, to find where the the segmentation fault = occures. What I don't know, though, how to do it. Can someone please point me out where I can get this information, or = tell how to do it under Dev-Cpp? Thanks everyone. |
From: Per W. <pw...@ia...> - 2007-07-20 17:53:23
|
Note that std::cout << "Hello world" << std::endl; is also file I/O. It's just that in this case, std::cout happens to be a predefined stream that maps to the standard-out file stream. No real difference from using printf("Hello world\n"); or fprintf(stdout,"Hello world\n"); or fwrite("Hello world\n",1,12,stdout); If you want to generate portable files, then you must yourself split the integer into bytes and emit them byte for byte. You can do this with something like: buf[0] = a & 0xff; buf[1] = (a >> 8) & 0xff; buf[2] = (a >> 16) & 0xff; buf[3] = (a >> 24) & 0xff; and then use fwrite to write out buf. /pwm On Fri, 20 Jul 2007, Kristian Magnani wrote: > Yes, the fopen lacked the "b" flag. Now it's working fine, Thanks a lot! > > I agree that the code mixes C and C++ I/O, but file I/O is done just with C-like file I/O, isn't it? C++ file I/O would imply in use of stream classes... > > Regarding the reading / writing integers, is there a way to specify the byte order, or should my code itself decompose the integers into bytes (using shifting operations and bit masks)? > > Thanks again. > > ----- Original Message ---- > From: Per Westermark <pw...@ia...> > To: Kristian Magnani <kri...@ya...> > Cc: dev...@li... > Sent: Thursday, July 19, 2007 7:29:20 PM > Subject: Re: [Dev-C++] fread get stuck > > It's a bit hurtfull to my eyes to see source code that mixes C and C++ > file I/O. I would recommend that you use one or the other. > > In your case, you have forgotten an important difference between Windows > and Unix. In Windows, there is a difference between binary and ASCII > files. When writing to a file opened in ASCII mode, any character "\n" > will be converted to "\r\n" (CR+LF), and when reading to a file opened in > ASCII mode, the caracters "\r\n" will be converted to a "\n". > > In your case, you are using fread() and fwrite() to read and write as if > the integers are binary data. That requires you to add a "b" to the mode > string of fopen(). > > Note that you are using a non-portable way if reading and writing > integers. The data is read and written in the byte order of the machine > you are currently using. A better way to create binary data files is to > beforehand specify a byte order, and then write the integers as separate > bytes. > > /pwm > > On Thu, 19 Jul 2007, Kristian Magnani wrote: > > > Hi, all! > > > > I've been using gcc in linux for a while, but now I'm trying do compile some example codes I've under Dev-C++, and I'm facing some problems. > > > > Below follow two programs: one opens a file where it write 1000 random numbers and the other open a file to read numbers and print them into the screen. Thet work perfectly under gcc/linux, but at Dev-C++/windows the program that reads the file get stuck at a particular number. For the same file, it always stops reading at the same line, although for different files, it stops at different lines. > > > > I suspect it's something defined as open behaviour in C/C++ specification, because the same programs work fine at gcc/linux, but I don't know what. Does anyone have an idea what I'm doing wrong? > > > > Thanks! > > > > > > > > #include <iostream> > > #include <stdlib.h> > > > > using namespace std; > > > > int main (int argc, char *argv[]) > > { > > /* inicializa gerador de numeros aleatorios */ > > srand(time(NULL)); > > > > /* abre arquivo para escrita, criando se nao existir */ > > /* cursos posicionado no inicio do arquivo */ > > FILE* file = fopen(argv[1], "w+"); > > if (file == NULL) > > { > > cout << "Erro ao criar arquivo." << endl; > > } > > else > > { > > for (int i = 0; i < 1000; i++) > > { > > > > /* pausa execucao */ > > if (i % 100 == 0 && i > 0) cin.get(); > > > > /* escreve um numero aleatorio no arquivo aberto */ > > int aleatorio = rand() % 1000; > > cout << i + 1 << "\tEscrevendo '" << aleatorio > > << "' no arquivo '" << argv[1] << "'." << endl; > > int elementosEscritos = fwrite(&aleatorio, 1, sizeof(int), file); > > if (elementosEscritos < 0) > > { > > cout << "Erro ao escrever em arquivo."; > > } > > } > > } > > > > /* fecha arquivo */ > > fclose(file); > > > > /* pausa execucao */ > > cin.get(); > > > > return 0; > > } > > > > > > > > > > > > > > #include <iostream.h> > > #include <stdlib.h> > > > > using namespace std; > > > > int main (int argc, char *argv[]) > > { > > > > /* abre arquivo para leitura */ > > /* cursos posicionado no inicio do arquivo */ > > FILE* file = fopen(argv[1], "r+"); > > if (file == NULL) > > { > > cout << "Erro ao abrir arquivo '" << argv[1] << "'." << endl; > > } > > else > > { > > int i = 0; > > int elementosLidos; > > int aleatorio; > > > > /* le um numero do arquivo aberto */ > > while (elementosLidos = fread(&aleatorio, sizeof(int), 1, file) > 0) > > { > > i++; > > cout << i << "\tLeu '" << aleatorio > > << "' (" << elementosLidos << " elementos) do arquivo '" > > << argv[1] << "'." << endl; > > } > > } > > > > /* fecha arquivo */ > > fclose(file); > > > > /* pausa execucao */ > > cin.get(); > > > > return 0; > > } > > > > > > > > > > > > > > ____________________________________________________________________________________ > > Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. > > http://sims.yahoo.com/ > > > > > > > > > > ____________________________________________________________________________________Ready for the edge of your seat? > Check out tonight's top picks on Yahoo! TV. > http://tv.yahoo.com/ |
From: Kristian M. <kri...@ya...> - 2007-07-20 16:21:59
|
Yes, the fopen lacked the "b" flag. Now it's working fine, Thanks a lot! I agree that the code mixes C and C++ I/O, but file I/O is done just with C-like file I/O, isn't it? C++ file I/O would imply in use of stream classes... Regarding the reading / writing integers, is there a way to specify the byte order, or should my code itself decompose the integers into bytes (using shifting operations and bit masks)? Thanks again. ----- Original Message ---- From: Per Westermark <pw...@ia...> To: Kristian Magnani <kri...@ya...> Cc: dev...@li... Sent: Thursday, July 19, 2007 7:29:20 PM Subject: Re: [Dev-C++] fread get stuck It's a bit hurtfull to my eyes to see source code that mixes C and C++ file I/O. I would recommend that you use one or the other. In your case, you have forgotten an important difference between Windows and Unix. In Windows, there is a difference between binary and ASCII files. When writing to a file opened in ASCII mode, any character "\n" will be converted to "\r\n" (CR+LF), and when reading to a file opened in ASCII mode, the caracters "\r\n" will be converted to a "\n". In your case, you are using fread() and fwrite() to read and write as if the integers are binary data. That requires you to add a "b" to the mode string of fopen(). Note that you are using a non-portable way if reading and writing integers. The data is read and written in the byte order of the machine you are currently using. A better way to create binary data files is to beforehand specify a byte order, and then write the integers as separate bytes. /pwm On Thu, 19 Jul 2007, Kristian Magnani wrote: > Hi, all! > > I've been using gcc in linux for a while, but now I'm trying do compile some example codes I've under Dev-C++, and I'm facing some problems. > > Below follow two programs: one opens a file where it write 1000 random numbers and the other open a file to read numbers and print them into the screen. Thet work perfectly under gcc/linux, but at Dev-C++/windows the program that reads the file get stuck at a particular number. For the same file, it always stops reading at the same line, although for different files, it stops at different lines. > > I suspect it's something defined as open behaviour in C/C++ specification, because the same programs work fine at gcc/linux, but I don't know what. Does anyone have an idea what I'm doing wrong? > > Thanks! > > > > #include <iostream> > #include <stdlib.h> > > using namespace std; > > int main (int argc, char *argv[]) > { > /* inicializa gerador de numeros aleatorios */ > srand(time(NULL)); > > /* abre arquivo para escrita, criando se nao existir */ > /* cursos posicionado no inicio do arquivo */ > FILE* file = fopen(argv[1], "w+"); > if (file == NULL) > { > cout << "Erro ao criar arquivo." << endl; > } > else > { > for (int i = 0; i < 1000; i++) > { > > /* pausa execucao */ > if (i % 100 == 0 && i > 0) cin.get(); > > /* escreve um numero aleatorio no arquivo aberto */ > int aleatorio = rand() % 1000; > cout << i + 1 << "\tEscrevendo '" << aleatorio > << "' no arquivo '" << argv[1] << "'." << endl; > int elementosEscritos = fwrite(&aleatorio, 1, sizeof(int), file); > if (elementosEscritos < 0) > { > cout << "Erro ao escrever em arquivo."; > } > } > } > > /* fecha arquivo */ > fclose(file); > > /* pausa execucao */ > cin.get(); > > return 0; > } > > > > > > > #include <iostream.h> > #include <stdlib.h> > > using namespace std; > > int main (int argc, char *argv[]) > { > > /* abre arquivo para leitura */ > /* cursos posicionado no inicio do arquivo */ > FILE* file = fopen(argv[1], "r+"); > if (file == NULL) > { > cout << "Erro ao abrir arquivo '" << argv[1] << "'." << endl; > } > else > { > int i = 0; > int elementosLidos; > int aleatorio; > > /* le um numero do arquivo aberto */ > while (elementosLidos = fread(&aleatorio, sizeof(int), 1, file) > 0) > { > i++; > cout << i << "\tLeu '" << aleatorio > << "' (" << elementosLidos << " elementos) do arquivo '" > << argv[1] << "'." << endl; > } > } > > /* fecha arquivo */ > fclose(file); > > /* pausa execucao */ > cin.get(); > > return 0; > } > > > > > > > ____________________________________________________________________________________ > Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. > http://sims.yahoo.com/ ____________________________________________________________________________________Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. http://tv.yahoo.com/ |
From: Peeyush B. <pee...@re...> - 2007-07-20 12:50:24
|
=0AHello ,=0A =0APut the strings of word in array of pointers. char *str[i= ] . Then compare the first the characters from str with "t". if it matches = print it or else neglect it.=0A=0Aregards=0APeeyush B.=0A=0A=0AOn Wed, 18 J= ul 2007 Lloyd wrote :=0A>Hi,=0A> I have an array of strings. I want to se= arch in the array for a=0A>particular pattern. As an example let the conten= t in the array be=0A>=0A>this=0A>thi=0A>this is=0A>hello=0A>t=0A>text=0A>hi= =0A>=0A>If I give a search term like "t*" (something like regular expressio= n) it=0A>must return=0A>=0A>this=0A>thi=0A>this is=0A>t=0A>text=0A>=0A>=0A>= How can I accomplish this?=0A>=0A>Thanks and Regards,=0A> Lloyd=0A>=0A>=0A= >______________________________________=0A>Scanned and protected by Email s= canner=0A>=0A>-------------------------------------------------------------= ------------=0A>This SF.net email is sponsored by DB2 Express=0A>Download D= B2 Express C - the FREE version of DB2 express and take=0A>control of your = XML. No limits. Just data. Click to get it now.=0A>http://sourceforge.net/p= owerbar/db2/=0A>_______________________________________________=0A>Dev-cpp-= users mailing list=0A>Dev...@li...=0A>TO UNSUBSCRIBE= : http://www23.brinkster.com/noicys/devcpp/ub.htm=0A>https://lists.sourcefo= rge.net/lists/listinfo/dev-cpp-users=0A=0A=0AWith Best Regards=0D=0A-------= ---------------------------------------------=0D=0APeeyush Bishnoi = =0D=0AC-DAC,Knowledge Park,=0D=0A#1,Old Madras Road, =0D=0ABa= ngalore,India.=0D=0AE-mail:pee...@cd...=0D=0A www.cdac.in= =0D=0APh. - (080) 25341909/874 ext.- 420=0D=0Acell- +91-9449673095=0D=0A---= ------------------------------------------------- |
From: Per W. <pw...@ia...> - 2007-07-20 09:46:17
|
Several problems with the code - below are a couple of them: 1) No fread() in this code, so obviously no fread can get stuck. 2) The copy-constructor copies a pointer, making multiple objects point to the same int buffer. What do you think happen when the first object gets destroyed, and the destructor releases this shared memory? 3) The get() function takes an object by value, i.e. it creates a new temporary object. What happens when this temporary object is destroyed? Will the get() function every be able to return back an object (if now get() is expected to read an object from file or similar)? 4) Don't you think that the destructor should use predecrement of the count static member, so that when the last object is destroyed, the count value 0 is printed? 5) If you impelemnt a copy constructor, where is the assignment operator? /pwm On 20 Jul 2007, Peeyush Bishnoi wrote: > Hello All > I am facing one problem in code below. This code is for copy constructor. > > Actaully when copy constructor gets called for get function with object b , the object value becomes 0. I think that that object b & object p are not pointing to same location as i explicitly declared the copy constructor. > > Please explain why it is so... Why object b value become 0 . Also how to avoid this so that object value should print actual value. > > #include<iostream> > using namespace std; > class A{ > static int count; > int *num; > public: > A():num(new int(2)){ > cout<<"Zero argument ctor called\n"<<endl; > count++; > } > > A(int i):num(new int(i)){ > cout<<"One arument ctor called\n"<<endl; > count++; > } > > A(const A &i):num(i.num){ > cout<<"Copy Ctor called\n"<<endl; > count++; > } > > void print(){ > > cout<<"count"<<count<<"Value:"<<*num<<endl; > } > > ~A(){ > cout<<"Dtor called\t"<<"count"<<count--<<endl; > delete num; > } > }; > > void get(A p){ > cout<<"get function called\n"<<endl; > p.print(); > } > > > int A::count; > > int main(){ > > A a; > a.print(); > A b(3); > b.print(); > get(b); > b.print(); > A c=a; > c.print(); > return 0; > } > > > Regards > Peeyush B. > > |
From: Peeyush B. <pee...@re...> - 2007-07-20 09:26:52
|
Hello All=0AI am facing one problem in code below. This code is for copy c= onstructor.=0A=0AActaully when copy constructor gets called for get functio= n with object b , the object value becomes 0. I think that that object b & = object p are not pointing to same location as i explicitly declared the cop= y constructor.=0A=0APlease explain why it is so... Why object b value becom= e 0 . Also how to avoid this so that object value should print actual value= .=0A=0A#include<iostream>=0Ausing namespace std;=0Aclass A{=0A stati= c int count;=0A int *num;=0A public:=0A A():num(new in= t(2)){=0A cout<<"Zero argument ctor called\n"<<endl;=0A = count++;=0A }=0A=0A A(int i):num(new int(i)){=0A = cout<<"One arument ctor called\n"<<endl;=0A co= unt++;=0A }=0A=0A A(const A &i):num(i.num){=0A = cout<<"Copy Ctor called\n"<<endl;=0A count++;=0A }= =0A=0A void print(){=0A=0A cout<<"count"<<count<<"Val= ue:"<<*num<<endl;=0A }=0A=0A ~A(){=0A cout<<"D= tor called\t"<<"count"<<count--<<endl;=0A delete num;=0A = }=0A};=0A=0Avoid get(A p){=0A cout<<"get function called= \n"<<endl;=0A p.print();=0A }=0A=0A=0Aint A::count;= =0A=0Aint main(){=0A=0AA a;=0Aa.print();=0AA b(3);=0Ab.print();=0Aget(b);= =0Ab.print();=0AA c=3Da;=0Ac.print();=0Areturn 0;=0A}=0A=0A=0ARegards=0APee= yush B.=0A=0A |
From: Per W. <pw...@ia...> - 2007-07-20 01:12:41
|
Actually, the switch statement is inside the while loop. The code just have a bit questionable indentation. Besides the strange indentation where the switch closing brace isn't below the starting brace, the while statement really should have used braces since it is so many lines long. /pwm On Thu, 19 Jul 2007, Adam Jones wrote: > The code you posted is listed below: > > >>#include <iostream> > >>#include <ctype.h> > >>using namespace std; > >>int main() > >>{ > >> char ch; > >> int aCnt =0, eCnt =0, iCnt =0, oCnt =0, uCnt =0, consonantCnt =0, > spaceCnt =0; > >> while ( cin >> ch ) > >> switch ( ch ) > >> { > >> case 'a': case 'A': > >> ++aCnt; > >> break; > >> case 'e': case 'E': > >> ++eCnt; > >> break; > >> case 'i': case 'I': > >> ++iCnt; > >> break; > >> case 'o': case 'O': > >> ++oCnt; > >> break; > >> case 'u': case 'U': > >> ++uCnt; > >> break; > >> case ' ': > >> ++spaceCnt; > >> default: > >> if ( isalpha( ch )) > >> ++consonantCnt; > >> break; > >> } > >> cout << " numero di a:" << aCnt << '\n'; > >> cout << " numero di e:" << eCnt << '\n'; > >> cout << " numero di i:" << iCnt << '\n'; > >> cout << " numero di o:" << oCnt << '\n'; > >> cout << " numero di u:" << uCnt << '\n'; > >> cout << " numero di consonanti:" << consonantCnt << '\n'; > >> cout << " numero di sapzi:" << spaceCnt << '\n'; > >> return 0; > >>} > > The problem with your code is that you do not enclose the switch statement > inside of your while loop. So what is happing is that the only line in your > program being executed is > > >> while ( cin >> ch ) > > You need to add the brackets after the while loop and enclose the switch > statement. Once you do that, it should work, > > while ( cin >> ch ) > { <--Add this openning bracket here > switch ( ch ) > { > case 'a': case 'A': > . > . > . > . > } <-- Add closing bracket here. > > -Adam Jones > > -----Original Message----- > From: dan...@li... [mailto:dan...@li...] > Sent: Thursday, July 19, 2007 9:57 AM > To: ajones > Subject: Re: [Dev-C++] Question > > This is the source code > > many thanks > > Danilo > > ---------- Initial Header ----------- > > >From : dev...@li... > To : "dev-c++ devc++" dev...@li... > Cc : > Date : Thu, 19 Jul 2007 08:59:23 -0400 > Subject : Re: [Dev-C++] Question > > > > > > > > > >>Hello, > > > > >>I have a problem with this program: when a give the execute comand > > >>the > > *.exe window opens but after I give the characters to switch as You > > can see on the While comand : >>while ( cin >> ch ) I can't make the > > execution of the program. > > > > >>There's a specific comand to give on the *.exe window for running > > >>the > > execution after writing on it? > > > > >>Many Thanks > > > > >>Danilo > > > > Unfortunately I am not sure what you are asking. If the program is not > > large, post the source code. How do you know that the code is not > running?? > > Maybe it is running, but you haven't paused executive so you can see > > the output. If you don't pause the executive the cin will get the > > input, the program will do what it has to do and then close the console > window. > > > > -Adam Jones > > > > > > > > ---------------------------------------------------------------------- > > --- This SF.net email is sponsored by DB2 Express Download DB2 Express > > C - the FREE version of DB2 express and take control of your XML. No > > limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > 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 > > > > > ------------------------------------------------------ > Leggi GRATIS le tue mail con il telefonino i-modeT di Wind > http://i-mode.wind.it/ > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > 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-19 22:33:07
|
The code you posted is listed below: >>#include <iostream> >>#include <ctype.h> >>using namespace std; >>int main() >>{ >> char ch; >> int aCnt =0, eCnt =0, iCnt =0, oCnt =0, uCnt =0, consonantCnt =0, spaceCnt =0; >> while ( cin >> ch ) >> switch ( ch ) >> { >> case 'a': case 'A': >> ++aCnt; >> break; >> case 'e': case 'E': >> ++eCnt; >> break; >> case 'i': case 'I': >> ++iCnt; >> break; >> case 'o': case 'O': >> ++oCnt; >> break; >> case 'u': case 'U': >> ++uCnt; >> break; >> case ' ': >> ++spaceCnt; >> default: >> if ( isalpha( ch )) >> ++consonantCnt; >> break; >> } >> cout << " numero di a:" << aCnt << '\n'; >> cout << " numero di e:" << eCnt << '\n'; >> cout << " numero di i:" << iCnt << '\n'; >> cout << " numero di o:" << oCnt << '\n'; >> cout << " numero di u:" << uCnt << '\n'; >> cout << " numero di consonanti:" << consonantCnt << '\n'; >> cout << " numero di sapzi:" << spaceCnt << '\n'; >> return 0; >>} The problem with your code is that you do not enclose the switch statement inside of your while loop. So what is happing is that the only line in your program being executed is >> while ( cin >> ch ) You need to add the brackets after the while loop and enclose the switch statement. Once you do that, it should work, while ( cin >> ch ) { <--Add this openning bracket here switch ( ch ) { case 'a': case 'A': . . . . } <-- Add closing bracket here. -Adam Jones -----Original Message----- From: dan...@li... [mailto:dan...@li...] Sent: Thursday, July 19, 2007 9:57 AM To: ajones Subject: Re: [Dev-C++] Question This is the source code many thanks Danilo ---------- Initial Header ----------- >From : dev...@li... To : "dev-c++ devc++" dev...@li... Cc : Date : Thu, 19 Jul 2007 08:59:23 -0400 Subject : Re: [Dev-C++] Question > >>Hello, > > >>I have a problem with this program: when a give the execute comand > >>the > *.exe window opens but after I give the characters to switch as You > can see on the While comand : >>while ( cin >> ch ) I can't make the > execution of the program. > > >>There's a specific comand to give on the *.exe window for running > >>the > execution after writing on it? > > >>Many Thanks > > >>Danilo > > Unfortunately I am not sure what you are asking. If the program is not > large, post the source code. How do you know that the code is not running?? > Maybe it is running, but you haven't paused executive so you can see > the output. If you don't pause the executive the cin will get the > input, the program will do what it has to do and then close the console window. > > -Adam Jones > > > > ---------------------------------------------------------------------- > --- This SF.net email is sponsored by DB2 Express Download DB2 Express > C - the FREE version of DB2 express and take control of your XML. No > limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > 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 > ------------------------------------------------------ Leggi GRATIS le tue mail con il telefonino i-modeT di Wind http://i-mode.wind.it/ |
From: Per W. <pw...@ia...> - 2007-07-19 22:29:31
|
It's a bit hurtfull to my eyes to see source code that mixes C and C++ file I/O. I would recommend that you use one or the other. In your case, you have forgotten an important difference between Windows and Unix. In Windows, there is a difference between binary and ASCII files. When writing to a file opened in ASCII mode, any character "\n" will be converted to "\r\n" (CR+LF), and when reading to a file opened in ASCII mode, the caracters "\r\n" will be converted to a "\n". In your case, you are using fread() and fwrite() to read and write as if the integers are binary data. That requires you to add a "b" to the mode string of fopen(). Note that you are using a non-portable way if reading and writing integers. The data is read and written in the byte order of the machine you are currently using. A better way to create binary data files is to beforehand specify a byte order, and then write the integers as separate bytes. /pwm On Thu, 19 Jul 2007, Kristian Magnani wrote: > Hi, all! > > I've been using gcc in linux for a while, but now I'm trying do compile some example codes I've under Dev-C++, and I'm facing some problems. > > Below follow two programs: one opens a file where it write 1000 random numbers and the other open a file to read numbers and print them into the screen. Thet work perfectly under gcc/linux, but at Dev-C++/windows the program that reads the file get stuck at a particular number. For the same file, it always stops reading at the same line, although for different files, it stops at different lines. > > I suspect it's something defined as open behaviour in C/C++ specification, because the same programs work fine at gcc/linux, but I don't know what. Does anyone have an idea what I'm doing wrong? > > Thanks! > > > > #include <iostream> > #include <stdlib.h> > > using namespace std; > > int main (int argc, char *argv[]) > { > /* inicializa gerador de numeros aleatorios */ > srand(time(NULL)); > > /* abre arquivo para escrita, criando se nao existir */ > /* cursos posicionado no inicio do arquivo */ > FILE* file = fopen(argv[1], "w+"); > if (file == NULL) > { > cout << "Erro ao criar arquivo." << endl; > } > else > { > for (int i = 0; i < 1000; i++) > { > > /* pausa execucao */ > if (i % 100 == 0 && i > 0) cin.get(); > > /* escreve um numero aleatorio no arquivo aberto */ > int aleatorio = rand() % 1000; > cout << i + 1 << "\tEscrevendo '" << aleatorio > << "' no arquivo '" << argv[1] << "'." << endl; > int elementosEscritos = fwrite(&aleatorio, 1, sizeof(int), file); > if (elementosEscritos < 0) > { > cout << "Erro ao escrever em arquivo."; > } > } > } > > /* fecha arquivo */ > fclose(file); > > /* pausa execucao */ > cin.get(); > > return 0; > } > > > > > > > #include <iostream.h> > #include <stdlib.h> > > using namespace std; > > int main (int argc, char *argv[]) > { > > /* abre arquivo para leitura */ > /* cursos posicionado no inicio do arquivo */ > FILE* file = fopen(argv[1], "r+"); > if (file == NULL) > { > cout << "Erro ao abrir arquivo '" << argv[1] << "'." << endl; > } > else > { > int i = 0; > int elementosLidos; > int aleatorio; > > /* le um numero do arquivo aberto */ > while (elementosLidos = fread(&aleatorio, sizeof(int), 1, file) > 0) > { > i++; > cout << i << "\tLeu '" << aleatorio > << "' (" << elementosLidos << " elementos) do arquivo '" > << argv[1] << "'." << endl; > } > } > > /* fecha arquivo */ > fclose(file); > > /* pausa execucao */ > cin.get(); > > return 0; > } > > > > > > > ____________________________________________________________________________________ > Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. > http://sims.yahoo.com/ |
From: Kristian M. <kri...@ya...> - 2007-07-19 21:09:07
|
Hi, all! I've been using gcc in linux for a while, but now I'm trying do compile some example codes I've under Dev-C++, and I'm facing some problems. Below follow two programs: one opens a file where it write 1000 random numbers and the other open a file to read numbers and print them into the screen. Thet work perfectly under gcc/linux, but at Dev-C++/windows the program that reads the file get stuck at a particular number. For the same file, it always stops reading at the same line, although for different files, it stops at different lines. I suspect it's something defined as open behaviour in C/C++ specification, because the same programs work fine at gcc/linux, but I don't know what. Does anyone have an idea what I'm doing wrong? Thanks! #include <iostream> #include <stdlib.h> using namespace std; int main (int argc, char *argv[]) { /* inicializa gerador de numeros aleatorios */ srand(time(NULL)); /* abre arquivo para escrita, criando se nao existir */ /* cursos posicionado no inicio do arquivo */ FILE* file = fopen(argv[1], "w+"); if (file == NULL) { cout << "Erro ao criar arquivo." << endl; } else { for (int i = 0; i < 1000; i++) { /* pausa execucao */ if (i % 100 == 0 && i > 0) cin.get(); /* escreve um numero aleatorio no arquivo aberto */ int aleatorio = rand() % 1000; cout << i + 1 << "\tEscrevendo '" << aleatorio << "' no arquivo '" << argv[1] << "'." << endl; int elementosEscritos = fwrite(&aleatorio, 1, sizeof(int), file); if (elementosEscritos < 0) { cout << "Erro ao escrever em arquivo."; } } } /* fecha arquivo */ fclose(file); /* pausa execucao */ cin.get(); return 0; } #include <iostream.h> #include <stdlib.h> using namespace std; int main (int argc, char *argv[]) { /* abre arquivo para leitura */ /* cursos posicionado no inicio do arquivo */ FILE* file = fopen(argv[1], "r+"); if (file == NULL) { cout << "Erro ao abrir arquivo '" << argv[1] << "'." << endl; } else { int i = 0; int elementosLidos; int aleatorio; /* le um numero do arquivo aberto */ while (elementosLidos = fread(&aleatorio, sizeof(int), 1, file) > 0) { i++; cout << i << "\tLeu '" << aleatorio << "' (" << elementosLidos << " elementos) do arquivo '" << argv[1] << "'." << endl; } } /* fecha arquivo */ fclose(file); /* pausa execucao */ cin.get(); return 0; } ____________________________________________________________________________________ Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. http://sims.yahoo.com/ |
From: Per W. <pw...@ia...> - 2007-07-19 17:14:39
|
Please don't unlink from the mailing list. 1) Your code will not get any data to process until you press enter. Then all characters up to the new-line will be processed one-by-one. 2) Your code will not leave the while loop until it gets an end-of-file, which it gets when you press Ctrl-C in Windows, and Ctrl-D on Unix systems. - Run your program. - Enter a sentence. - Press Enter. - Press Ctrl-C. - Read the statistics from the sentence. /pwm On Thu, 19 Jul 2007, dan...@li... wrote: > > My guess is that he hasn't realized that he has to press Ctrl-C to to end= the program > > > It's not that the problem, i think it's that i don't know hoe to go out f= rom the While(..) comand, because i write some phrases but i don't have any= count from the program in output, as you can try. I think i didn't put an = "end of file" comand in the While() so i can't go out from this > > Danilo > > ---------- Initial Header ----------- > > >From : dev...@li... > To : "Adam Jones" aj...@i-... > Cc : "dev-c++ devc++" dev...@li... > Date : Thu, 19 Jul 2007 16:11:33 +0200 (CEST) > Subject : Re: [Dev-C++] Question > > > > > > > > > He did send the source as an attachment, but did not clearly specify wh= at > > problem he has with this school assignment. > > > > My guess is that he hasn't realized that he has to press Ctrl-C to end = the > > program (or Ctrl-D if run on a Unix machine). > > > > /pwm > > > > On Thu, 19 Jul 2007, Adam Jones wrote: > > > > > >>Hello, > > > > > > >>I have a problem with this program: when a give the execute comand = the > > > *.exe window opens but after I give the characters to switch as You c= an see > > > on the While comand : >>while ( cin >> ch ) I can't make the executio= n of > > > the program. > > > > > > >>There's a specific comand to give on the *.exe window for running t= he > > > execution after writing on it? > > > > > > >>Many Thanks > > > > > > >>Danilo > > > > > > Unfortunately I am not sure what you are asking. If the program is no= t > > > large, post the source code. How do you know that the code is not run= ning?? > > > Maybe it is running, but you haven't paused executive so you can see = the > > > output. If you don't pause the executive the cin will get the input, = the > > > program will do what it has to do and then close the console window. > > > > > > -Adam Jones > > > > > > > > > > > > ---------------------------------------------------------------------= ---- > > > This SF.net email is sponsored by DB2 Express > > > Download DB2 Express C - the FREE version of DB2 express and take > > > control of your XML. No limits. Just data. Click to get it now. > > > http://sourceforge.net/powerbar/db2/ > > > _______________________________________________ > > > 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 DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > 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 > > > > > ------------------------------------------------------ > Leggi GRATIS le tue mail con il telefonino i-mode=99 di Wind > http://i-mode.wind.it/ > > |
From: Per W. <pw...@ia...> - 2007-07-19 14:11:53
|
He did send the source as an attachment, but did not clearly specify what problem he has with this school assignment. My guess is that he hasn't realized that he has to press Ctrl-C to end the program (or Ctrl-D if run on a Unix machine). /pwm On Thu, 19 Jul 2007, Adam Jones wrote: > >>Hello, > > >>I have a problem with this program: when a give the execute comand the > *.exe window opens but after I give the characters to switch as You can see > on the While comand : >>while ( cin >> ch ) I can't make the execution of > the program. > > >>There's a specific comand to give on the *.exe window for running the > execution after writing on it? > > >>Many Thanks > > >>Danilo > > Unfortunately I am not sure what you are asking. If the program is not > large, post the source code. How do you know that the code is not running?? > Maybe it is running, but you haven't paused executive so you can see the > output. If you don't pause the executive the cin will get the input, the > program will do what it has to do and then close the console window. > > -Adam Jones > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > 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-19 12:59:40
|
>>Hello, >>I have a problem with this program: when a give the execute comand the *.exe window opens but after I give the characters to switch as You can see on the While comand : >>while ( cin >> ch ) I can't make the execution of the program. >>There's a specific comand to give on the *.exe window for running the execution after writing on it? >>Many Thanks >>Danilo Unfortunately I am not sure what you are asking. If the program is not large, post the source code. How do you know that the code is not running?? Maybe it is running, but you haven't paused executive so you can see the output. If you don't pause the executive the cin will get the input, the program will do what it has to do and then close the console window. -Adam Jones |
From: danilo\.ferrarotti\@libero\.it <dan...@li...> - 2007-07-19 09:22:23
|
Hello, I have a problem with this program: when a give the execute comand the *.= exe window opens but after I give the characters to switch as You can see= on the While comand : while ( cin >> ch ) I can't make the execution of the program. There's a specific comand to give on the *.exe window for running the exe= cution after writing on it? Many Thanks Danilo =0A=0A=0A------------------------------------------------------=0ALeggi G= RATIS le tue mail con il telefonino i-mode=99 di Wind=0Ahttp://i-mode.win= d.it/=0A |
From: Adam J. <aj...@i-...> - 2007-07-19 02:30:00
|
>>By the way, have you looked at Code::Blocks as a replacement environment >>for Dev-C++? >>Dev-C++ is basically a dead environment, with no active developers. Since >>it is developed using Delphi, not too many are able to help fix bugs and >>add new features. I was not aware of this, I know of others who are using code::blocks. When I Get the time I will take a look at it. Thanks again! -Adam Jones -----Original Message----- From: Per Westermark [mailto:pw...@ia...] Sent: Wednesday, July 18, 2007 10:52 AM To: Adam Jones Subject: Re: [Dev-C++] Dev C++ debugger problems By the way, have you looked at Code::Blocks as a replacement environment for Dev-C++? Dev-C++ is basically a dead environment, with no active developers. Since it is developed using Delphi, not too many are able to help fix bugs and add new features. /pwm On Wed, 18 Jul 2007, Adam Jones wrote: > >>Alas, the debugger integration Dev-C++ is not too good. > > >>Do yourself a favour and download one of the available graphical > >>front-ends (such as Insight) for gdb and debug your application outside > >>Dev-C++. You can add a 'Tool' menu item to directly start an external > >>debugging session. > > Thank you! I will look into this product. Because I am not a fan of the > command line gdb. > > -Adam Jones > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > 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-19 01:48:45
|
No problem I am glad I could be of assistance. -Adam Jones -----Original Message----- From: Lloyd [mailto:ll...@cd...] Sent: Wednesday, July 18, 2007 10:44 AM To: Adam Jones Subject: Re: [Dev-C++] searching in array Thank you Adam, really it helps :) Regards, Lloyd On Wed, 2007-07-18 at 09:31 -0400, Adam Jones wrote: > You should check out the Boost.Regex function. This allows you to do regular > expression searches on strings. Here are two links you should check out: > > http://www.boost.org/libs/regex/doc/index.html > http://www.onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html > > I hope this helps. > > -Adam Jones > > > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Lloyd > Sent: Wednesday, July 18, 2007 4:31 AM > To: dev...@li... > Subject: [Dev-C++] searching in array > > Hi, > I have an array of strings. I want to search in the array for a > particular pattern. As an example let the content in the array be > > this > thi > this is > hello > t > text > hi > > If I give a search term like "t*" (something like regular expression) it > must return > > this > thi > this is > t > text > > > How can I accomplish this? > > Thanks and Regards, > Lloyd > > > ______________________________________ > Scanned and protected by Email scanner > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > 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 DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ______________________________________ Scanned and protected by Email scanner |
From: <Ulr...@ao...> - 2007-07-18 19:44:04
|
Dear community, who knows which library has to be added if the linker complains in working on libstdc++.a undefined references to wctob , btowc, wctype , mbttowc The libraries in action are -lopenglut -lglu32 -lopengl32 -lwinmm -lgdi32 Would be great to get a hind. Is it some wide character support? but where? Best regards Ulrich |
From: Adam J. <aj...@i-...> - 2007-07-18 13:31:44
|
You should check out the Boost.Regex function. This allows you to do regular expression searches on strings. Here are two links you should check out: http://www.boost.org/libs/regex/doc/index.html http://www.onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html I hope this helps. -Adam Jones -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Lloyd Sent: Wednesday, July 18, 2007 4:31 AM To: dev...@li... Subject: [Dev-C++] searching in array Hi, I have an array of strings. I want to search in the array for a particular pattern. As an example let the content in the array be this thi this is hello t text hi If I give a search term like "t*" (something like regular expression) it must return this thi this is t text How can I accomplish this? Thanks and Regards, Lloyd ______________________________________ Scanned and protected by Email scanner ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ 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-18 13:15:39
|
>>Alas, the debugger integration Dev-C++ is not too good. >>Do yourself a favour and download one of the available graphical >>front-ends (such as Insight) for gdb and debug your application outside >>Dev-C++. You can add a 'Tool' menu item to directly start an external >>debugging session. Thank you! I will look into this product. Because I am not a fan of the command line gdb. -Adam Jones |
From: Per W. <pw...@ia...> - 2007-07-18 08:25:57
|
The same way you would do it if you just have a single string. Just add a loop to iterate through all entries in the array and perform your pattern matching for each entry. /pwm On Wed, 18 Jul 2007, Lloyd wrote: > Hi, > I have an array of strings. I want to search in the array for a > particular pattern. As an example let the content in the array be > > this > thi > this is > hello > t > text > hi > > If I give a search term like "t*" (something like regular expression) it > must return > > this > thi > this is > t > text > > > How can I accomplish this? > > Thanks and Regards, > Lloyd > > > ______________________________________ > Scanned and protected by Email scanner > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > 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: Lloyd <ll...@cd...> - 2007-07-18 08:23:27
|
Hi, I have an array of strings. I want to search in the array for a particular pattern. As an example let the content in the array be this thi this is hello t text hi If I give a search term like "t*" (something like regular expression) it must return this thi this is t text How can I accomplish this? Thanks and Regards, Lloyd ______________________________________ Scanned and protected by Email scanner |