dev-cpp-users Mailing List for Dev-C++ (Page 27)
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: Per W. <pw...@ia...> - 2008-06-19 17:10:26
|
TerminateProcess is a very, very brutal call and should be avoided at all costs. Termination means that the program may not perform any cleanup. The best way to ask a Windows application to end is to post a WM_CLOSE message to it. In some situations a WM_QUIT message may also be used. /pwm On Thu, 19 Jun 2008 Mat...@bm... wrote: > If you are using win32 you can use the TerminateProcess API call. > > http://msdn.microsoft.com/en-us/library/ms686714(VS.85).aspx > > > > ________________________________________ > From: dev...@li... [mailto:dev...@li...] On Behalf Of angel dario > Sent: 18 June 2008 21:36 > To: Dev-C++ Mainling > Subject: [Dev-C++] Task Manager Process > > > Is there a way to end a process (Task Manager, Process) programmatically using C++? > ________________________________________ > Need to know now? Get instant answers with Windows Live Messenger. IM on your terms. > This email was sent from an email account of BMW (UK) Manufacturing Limited. BMW (UK) Manufacturing Limited is a company registered in England and Wales with company number 3950868; and has its offices at Ellesfield Avenue, Bracknell, Berkshire, RG12 8TA; registered in England and Wales. The contents of this e-mail are confidential and may be privileged and subject to internal monitoring. If you are not the addressee indicated in this message, you may not copy, forward, disclose, deliver or otherwise use it or any part of it in any form whatsoever. You should then kindly notify the sender by replying to this message and destroy it thereafter. Opinions, conclusions and other information in this message that do not relate to the official business of any BMW Group Company shall be understood as neither given nor endorsed by them. > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > 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: <Mat...@bm...> - 2008-06-19 11:33:04
|
If you are using win32 you can use the TerminateProcess API call. http://msdn.microsoft.com/en-us/library/ms686714(VS.85).aspx ________________________________________ From: dev...@li... [mailto:dev...@li...] On Behalf Of angel dario Sent: 18 June 2008 21:36 To: Dev-C++ Mainling Subject: [Dev-C++] Task Manager Process Is there a way to end a process (Task Manager, Process) programmatically using C++? ________________________________________ Need to know now? Get instant answers with Windows Live Messenger. IM on your terms. This email was sent from an email account of BMW (UK) Manufacturing Limited. BMW (UK) Manufacturing Limited is a company registered in England and Wales with company number 3950868; and has its offices at Ellesfield Avenue, Bracknell, Berkshire, RG12 8TA; registered in England and Wales. The contents of this e-mail are confidential and may be privileged and subject to internal monitoring. If you are not the addressee indicated in this message, you may not copy, forward, disclose, deliver or otherwise use it or any part of it in any form whatsoever. You should then kindly notify the sender by replying to this message and destroy it thereafter. Opinions, conclusions and other information in this message that do not relate to the official business of any BMW Group Company shall be understood as neither given nor endorsed by them. |
From: angel d. <sci...@ho...> - 2008-06-18 20:36:06
|
Is there a way to end a process (Task Manager, Process) programmatically using C++? _________________________________________________________________ Need to know now? Get instant answers with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_062008 |
From: Serena F. <fa...@df...> - 2008-06-18 16:54:45
|
Hello, I have a problem with DEV C++ 4.9.9.2. When I compile my Project there are not errors, but if I select "Syntax Check" from Execute menu a error appears: [Warning] nul.gcda is not a gcov data file What does it mean? Where is the trouble? Thank you for your attention. S. Fabbri |
From: Jorge G. <jor...@gm...> - 2008-06-16 01:05:16
|
hi how write this in c++?, could i use <fstream> this it´s ok, (c and gnuplot) /******/ #include <stdio.h> #include <stdlib.h> #define GNUPLOT_PATH "D:/instaladores/gnuplot/gnuplot/bin/pgnuplot" int main (int argc, const char * argv[]) { FILE *gp; gp = popen(GNUPLOT_PATH, "w"); if(gp == NULL){ fprintf(stderr, "Oops, I can't find %s.", GNUPLOT_PATH); exit(EXIT_FAILURE); } //fprintf(gp, "set term aqua title \"Function A\" \n"); fprintf(gp, "set samples 2048 \n"); fprintf(gp, "plot [-512:512] -abs(x*sin(sqrt(abs(x))))+400\n"); fflush(gp); getchar(); pclose(gp); return(EXIT_SUCCESS); } /**************/ i have a problem here: /**************/ #include <cstdlib> #include <fstream> #include <iostream> #define GNUPLOT_PATH "D:/instaladores/gnuplot/gnuplot/bin/pgnuplot" using namespace std; int main() { fstream fSalida; fSalida.open(GNUPLOT_PATH,ios::out|ios::app ); //¿¿¿ :-) // cout<<fSalida<<"set samples 2048"<<endl; // cout<<fSalida<<"plot [-512:512] -abs(x*sin(sqrt(abs(x))))+400"<<endl;; system("PAUSE"); return EXIT_SUCCESS; } /**************/ |
From: Deepesh K. <dee...@gm...> - 2008-06-15 21:28:38
|
try looking here: http://www.websy.net/blog/Tutorial/2008/04/tutorial/software-localization/ On Sun, Jun 15, 2008 at 2:08 AM, Jan Mura <jan...@vo...> wrote: > Hello, > > I would like to know if anyone knows about the information or tuttorilas > regarding a software localization. > I would like to modify a source of a program correctly works in english > environment(ISO8859-1) for ISO8895-2, UTF-8 and so. > > Thanks for any info. > > Jan Mura > jan...@vo... > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > 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 > -- ---Deepesh Kapadia--- |
From: Jan M. <jan...@vo...> - 2008-06-14 14:09:02
|
Hello, I would like to know if anyone knows about the information or tuttorilas regarding a software localization. I would like to modify a source of a program correctly works in english environment(ISO8859-1) for ISO8895-2, UTF-8 and so. Thanks for any info. Jan Mura jan...@vo... |
From: dhruva c. <nar...@ya...> - 2008-06-13 18:57:45
|
--- On Sat, 14/6/08, dhruva chandra <nar...@ya...> wrote: From: dhruva chandra <nar...@ya...> Subject: problem with dev c++ To: dev...@li... Date: Saturday, 14 June, 2008, 12:14 AM Hi, I had a problem in dev c++. namely none of the programs of ver 4.9.8 are able 2 run on ver 4.9.9.2!! I dono hw 2 get it done.. as in, is there ne need of including some header files which must b missin in newer ver(m a beginer with dev c++).. I also wanted 2 kno if ver 4.9.9.2 supports ftp file transfer by ne chance??.. Best Jokes, Best Friends, Best Food. Get all this and more on Best of Yahoo! Groups. Meet people who discuss and share your passions. Go to http://in.promos.yahoo.com/groups/bestofyahoo/ |
From: dhruva c. <nar...@ya...> - 2008-06-13 18:44:53
|
Hi, I had a problem in dev c++. namely none of the programs of ver 4.9.8 are able 2 run on ver 4.9.9.2!! I dono hw 2 get it done.. as in, is there ne need of including some header files which must b missin in newer ver(m a beginer with dev c++).. I also wanted 2 kno if ver 4.9.9.2 supports ftp file transfer by ne chance??.. Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/ |
From: Per W. <pw...@ia...> - 2008-06-11 06:12:52
|
Only C/C++ code that have seen the declaration of a structure may access contents of it - if you don't play with type casts and claims that a variable is of a different type. Yuor library must export accessor functions that will read or write attributes of variables of the hidden data type. One library function can return a handle or a void pointer to a variable of the hidden struct. Other library functions can take the handle or void pointer and create a pointer of correct type and then perform operations. /pwm On Mon, 9 Jun 2008, Xetro Pulsar wrote: > Hi List, > > I have this qn. > > I am using a complex library and need to modify one of its files. I include > the library files with standard #include, those files then in turn include > other files as required. > > Now, I am declaring a structure in the original .cpp file........lets say > test.cpp and trying to access it through the library file. But quite clearly > compiler doesnt allow it. > > Now how do I declare the structure in the original .cpp file using some > namespace and access it through the library file? > > Please lemme know if I am not clear. I will update the question to make it > more clear. > > Thanks & Regards, > Xetro > |
From: Xetro P. <pul...@gm...> - 2008-06-09 05:40:12
|
Hi List, I have this qn. I am using a complex library and need to modify one of its files. I include the library files with standard #include, those files then in turn include other files as required. Now, I am declaring a structure in the original .cpp file........lets say test.cpp and trying to access it through the library file. But quite clearly compiler doesnt allow it. Now how do I declare the structure in the original .cpp file using some namespace and access it through the library file? Please lemme know if I am not clear. I will update the question to make it more clear. Thanks & Regards, Xetro |
From: Per W. <pw...@ia...> - 2008-06-03 22:05:25
|
The question you should ask your self is: Are we helping you? If this is a school assignment - which it looks to be - you can either use my code (which would be a copyright violation and a violation of the terms your school has), or you can look at my original post and then sit down and spend some time on your own. What code can _you_ produce? How would _you_ solve the problem? What would _you_ learn if _you_ spend the time to wrangle a bit with your own code? You can only improve as a developer - and turn in a solution to your teacher with pride - if you spend real time programming. When you turn in a job, you should not only be able to answer what a code line does. You should also be able to answer why the line is there, and why it looks as it does. How much do you learn if you use a runtime-library function that someone have told you to use? How much do you learn if you search through the large set of available functions and select the ones to use yourself? How many other functions will you learn about if you do not study the standard functions available? My suggestion: Do not continue with my code. Write a solution in C++ instead, by using streams. Then you will learn something new and you will feel that you have done something. Just realize that a C++ implementation is not a C implementation with function calls translated into "C++ functions". If you use streams, scan Google for a reasonable amount of demo applications using streams and look how they do things. Don't copy-paste individual code lines, but look how elegant streams-based C++ code should look and then design something similar but intended to solve your specific problem. And for every variable or method code: Always think what it does, and why you need it. And every time you call a function - check in the manual if it may fail and why it may fail. What will _your_ code do to either make sure that it can not fail, or to give a correct error message in case it fails? Another thing: Spend time to figure out how you should test your code. What is a reasonable "data file"? What are reasonable - and unreasonable - search terms that you should test your code with. What happens if the text matches?`What happens if the text doesn't match? Can you get buffer overflows? Can you fail to open the data file? Does it matter if you specify the word in capitals or mixed-case? Will it always produce a result (or a failure) within a finite time? Will it always perform it's job in a finite amount of memory? Does it matter if you run it on a 16-bit or a 32-bit or a 64-bit processor? Does it matter if the processor stores integers with least significant byte at lowest or highest memory address? Does it matter if the compiler has signed or unsigned charactesr? What happens if the data file is on a network, and the network cable is unplugged in the middle of a scan? Are you making use of dynamic memory - what happens if a memory allocation fails? In short - no, you are not helped by getting turn-key implementations. The only thing that helps you is you spending time doing exercices and you thinking and you reading and you making mistakes and you detecting your mistkaes and you correcting them. /pwm On Tue, 3 Jun 2008, Alexsandro Meireles wrote: > Thank you all for helping me out. > > > From: dev...@li...> Subject: Dev-cpp-users Digest, Vol 25, Issue 1> To: dev...@li...> Date: Tue, 3 Jun 2008 01:33:27 -0700> > Send Dev-cpp-users mailing list submissions to> dev...@li...> > To subscribe or unsubscribe via the World Wide Web, visit> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users> or, via email, send a message with subject or body 'help' to> dev...@li...> > You can reach the person managing the list at> dev...@li...> > When replying, please edit your Subject line so it is more specific> than "Re: Contents of Dev-cpp-users digest..."> > > Today's Topics:> > 1. Re: templates + linker error (Per Westermark)> 2. Re: templates + linker error (Jorge Guevara)> 3. Re: templates + linker error (Per Westermark)> 4. Choose a word from a .txt file (Alexsandro Meireles)> 5. Re: Choose a word from a .txt file (Lloyd)> 6. Re: Choose a word from a .txt file (Per Westermark)> 7. Re: Choose a word from a .txt file (Per Westermark)> > > ----------------------------------------------------------------------> > Message: 1> Date: Mon, 26 May 2008 20:12:24 +0200 (CEST)> From: Per Westermark <pw...@ia...>> Subject: Re: [Dev-C++] templates + linker error> To: Lloyd <ll...@cd...>> Cc: dev...@li...> Message-ID:> <Pin...@ia...>> Content-Type: TEXT/PLAIN; charset=US-ASCII> > Think a bit about it.> > What code to you suggest that the compiler should enerate when it compiles> calc.cpp? If the compiler does not know that other source files will use> the template parameter "double", how will the compiler then be able to add> a "double" version of multiply when it compiles calc.cpp?> > Remember that it is the compiler, not the linker, that produces the> runnable code. The linker will have no use for an object file that doesn't> contain instantiated template functions.> > /pwm> > On Mon, 26 May 2008, Lloyd wrote:> > > The reason for the error is you are not passing the obj file of calc.cpp> > to the linker. Make appropriate settings in DevCpp. I think, you have to> > add calc.cpp to your project. Sorry I dont use DevCpp.> >> >> > On Sun, 2008-05-25 at 16:42 -0500, Jorge Guevara wrote:> > >> > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it> > > with devcpp)> > >> > > i have this error:> > > In function `main':> > > [Linker error] undefined reference to `calc<double>::multiply(double,> > > double)'> > > ld returned 1 exit status> > > [Build Error] ["Proyecto] Error 1> > >> > > somebody could help me please :)> > >> > > /********calc.h******/> > > #ifndef _CALC_H> > > #define _CALC_H> > >> > > template <class A_Type> class calc> > > {> > > public:> > > A_Type multiply(A_Type x, A_Type y);> > > A_Type add(A_Type x, A_Type y);> > >> > > };> > >> > > #endif> > >> > > /****calc.cpp******/> > > #include "calc.h"> > > #include <iostream>> > > using namespace std;> > >> > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type> > > y)> > > {> > > return x*y;> > > }> > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y)> > > {> > > return x+y;> > > }> > >> > >> > > /******principal.cpp*****/> > > #include "calc.h"> > > #include <iostream>> > > #include <cstdlib>> > >> > > using namespace std;> > >> > > int main()> > > {> > > calc <double> a_calc_class;> > > double a, b;> > > a=4.3;> > > b=3.4;> > > a_calc_class.multiply(a,b);> > >> > > system("PAUSE");> > > return EXIT_SUCCESS;> > > }> > > /***************************/> > >> > >> > > -------------------------------------------------------------------------> > > This SF.net email is sponsored by: Microsoft> > > Defy all challenges. Microsoft(R) Visual Studio 2008.> > > 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> >> >> > ______________________________________> > Scanned and protected by Email scanner> >> > -------------------------------------------------------------------------> > This SF.net email is sponsored by: Microsoft> > Defy all challenges. Microsoft(R) Visual Studio 2008.> > 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> >> > > > > ------------------------------> > Message: 2> Date: Tue, 27 May 2008 15:17:27 -0500> From: "Jorge Guevara" <jor...@gm...>> Subject: Re: [Dev-C++] templates + linker error> To: "Per Westermark" <pw...@ia...>> Cc: dev...@li...> Message-ID:> <51a...@ma...>> Content-Type: text/plain; charset="iso-8859-1"> > I try with this. and no problem> > #include <iostream>> #include <cstdlib>> #include "mypair.hpp"> #include "mypair.cpp" // i include the implementation in the source> principal.cpp> > the question is less efficient?, or its ok?> > bytes> > > 2008/5/26, Per Westermark <pw...@ia...>:> >> > The compiler can't create the code for a template function unless it sees> > the implementation when you try to use the template function.> >> > You should have the implementation of your multiply function in the header> > file, and not hidden in a cpp file.> >> > It is only the linker that will see the generated code from multiple cpp> > files, and neither the compiler nor the compiler knows that calc.cpp> > should create a specific version of the multiply function with the double> > data type.> >> > /pwm> >> >> > On Sun, 25 May 2008, Jorge Guevara wrote:> >> > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it with> > > devcpp)> > >> > > i have this error:> > > In function `main':> > > [Linker error] undefined reference to `calc<double>::multiply(double,> > > double)'> > > ld returned 1 exit status> > > [Build Error] ["Proyecto] Error 1> > >> > > somebody could help me please :)> > >> > > /********calc.h******/> > > #ifndef _CALC_H> > > #define _CALC_H> > >> > > template <class A_Type> class calc> > > {> > > public:> > > A_Type multiply(A_Type x, A_Type y);> > > A_Type add(A_Type x, A_Type y);> > >> > > };> > >> > > #endif> > >> > > /****calc.cpp******/> > > #include "calc.h"> > > #include <iostream>> > > using namespace std;> > >> > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type y)> > > {> > > return x*y;> > > }> > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y)> > > {> > > return x+y;> > > }> > >> > >> > > /******principal.cpp*****/> > > #include "calc.h"> > > #include <iostream>> > > #include <cstdlib>> > >> > > using namespace std;> > >> > > int main()> > > {> > > calc <double> a_calc_class;> > > double a, b;> > > a=4.3;> > > b=3.4;> > > a_calc_class.multiply(a,b);> > >> > > system("PAUSE");> > > return EXIT_SUCCESS;> > > }> > > /***************************/> > >> >> >> > > -- > Ing. Jorge Luis Guevara Diaz> Bs Ciencias de la Computacion> Maestrante en Ciencia de la Computaci?n> http://jorge.sistemasyservidores.com http://inf.unitru.edu.pe/~jlgd> Escuela de Inform?tica - Universidad Nacional de Trujillo> Escuela de Ingenier?a de Sistemas - Universidad Privada del Norte> -------------- next part --------------> An HTML attachment was scrubbed...> > ------------------------------> > Message: 3> Date: Wed, 28 May 2008 06:36:29 +0200 (CEST)> From: Per Westermark <pw...@ia...>> Subject: Re: [Dev-C++] templates + linker error> To: Jorge Guevara <jor...@gm...>> Cc: dev...@li...> Message-ID:> <Pin...@ia...>> Content-Type: TEXT/PLAIN; charset=ISO-8859-1> > Always avoid including cpp files. cpp files are indented to generate> object files and be linked.> > Templated functions are intended to be compiled into object files first> when needed. As I wrote in one of my earlier mails, template functions> should be placed in the relevant header file.> > Look at the STL files: In all cases, the actual source code> for the implementations of lists, trees, arrays etc are available in the> header files.> > /pwm> > On Tue, 27 May 2008, Jorge Guevara wrote:> > > I try with this. and no problem> >> > #include <iostream>> > #include <cstdlib>> > #include "mypair.hpp"> > #include "mypair.cpp" // i include the implementation in the source> > principal.cpp> >> > the question is less efficient?, or its ok?> >> > bytes> >> >> > 2008/5/26, Per Westermark <pw...@ia...>:> > >> > > The compiler can't create the code for a template function unless it sees> > > the implementation when you try to use the template function.> > >> > > You should have the implementation of your multiply function in the header> > > file, and not hidden in a cpp file.> > >> > > It is only the linker that will see the generated code from multiple cpp> > > files, and neither the compiler nor the compiler knows that calc.cpp> > > should create a specific version of the multiply function with the double> > > data type.> > >> > > /pwm> > >> > >> > > On Sun, 25 May 2008, Jorge Guevara wrote:> > >> > > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it with> > > > devcpp)> > > >> > > > i have this error:> > > > In function `main':> > > > [Linker error] undefined reference to `calc<double>::multiply(double,> > > > double)'> > > > ld returned 1 exit status> > > > [Build Error] ["Proyecto] Error 1> > > >> > > > somebody could help me please :)> > > >> > > > /********calc.h******/> > > > #ifndef _CALC_H> > > > #define _CALC_H> > > >> > > > template <class A_Type> class calc> > > > {> > > > public:> > > > A_Type multiply(A_Type x, A_Type y);> > > > A_Type add(A_Type x, A_Type y);> > > >> > > > };> > > >> > > > #endif> > > >> > > > /****calc.cpp******/> > > > #include "calc.h"> > > > #include <iostream>> > > > using namespace std;> > > >> > > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type y)> > > > {> > > > return x*y;> > > > }> > > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y)> > > > {> > > > return x+y;> > > > }> > > >> > > >> > > > /******principal.cpp*****/> > > > #include "calc.h"> > > > #include <iostream>> > > > #include <cstdlib>> > > >> > > > using namespace std;> > > >> > > > int main()> > > > {> > > > calc <double> a_calc_class;> > > > double a, b;> > > > a=4.3;> > > > b=3.4;> > > > a_calc_class.multiply(a,b);> > > >> > > > system("PAUSE");> > > > return EXIT_SUCCESS;> > > > }> > > > /***************************/> > > >> > >> > >> >> >> > --> > Ing. Jorge Luis Guevara Diaz> > Bs Ciencias de la Computacion> > Maestrante en Ciencia de la Computaci?n> > http://jorge.sistemasyservidores.com http://inf.unitru.edu.pe/~jlgd> > Escuela de Inform?tica - Universidad Nacional de Trujillo> > Escuela de Ingenier?a de Sistemas - Universidad Privada del Norte> >> > > > > ------------------------------> > Message: 4> Date: Tue, 3 Jun 2008 01:24:13 -0300> From: Alexsandro Meireles <ale...@ho...>> Subject: [Dev-C++] Choose a word from a .txt file> To: <dev...@li...>> Message-ID: <BAY...@ph...l>> Content-Type: text/plain; charset="iso-8859-1"> > Dear users,> > How can I write a script to look a word in a .txt file with two columns (one is the word and the other is the answer I need) and give an answer which is in the second column. In other words, a user types a word, then the script match it with a word in a .txt file (first column) and gives the answer (second column).> > Thanks in advance!> > Alex.> _________________________________________________________________> Cansado de espa?o para s? 50 fotos? Conhe?a o Spaces, o site de relacionamentos com at? 6,000 fotos!> http://www.amigosdomessenger.com.br> -------------- next part --------------> An HTML attachment was scrubbed...> > ------------------------------> > Message: 5> Date: Tue, 03 Jun 2008 10:19:31 +0530> From: Lloyd <ll...@cd...>> Subject: Re: [Dev-C++] Choose a word from a .txt file> To: Alexsandro Meireles <ale...@ho...>> Cc: dev...@li...> Message-ID: <1212468571.3808.1.camel@RCCF025>> Content-Type: text/plain> > Wouldn't regular expression search help you? May be better solution> could be there...> > check for regex in www.boost.org> > > On Tue, 2008-06-03 at 01:24 -0300, Alexsandro Meireles wrote:> > Dear users,> > > > How can I write a script to look a word in a .txt file with two> > columns (one is the word and the other is the answer I need) and give> > an answer which is in the second column. In other words, a user types> > a word, then the script match it with a word in a .txt file (first> > column) and gives the answer (second column).> > > > Thanks in advance!> > > > Alex.> > > > > > ______________________________________> Scanned and protected by Email scanner> > > > ------------------------------> > Message: 6> Date: Tue, 3 Jun 2008 10:31:54 +0200 (CEST)> From: Per Westermark <pw...@ia...>> Subject: Re: [Dev-C++] Choose a word from a .txt file> To: Alexsandro Meireles <ale...@ho...>> Cc: dev...@li...> Message-ID:> <Pin...@ia...>> Content-Type: TEXT/PLAIN; charset=ISO-8859-1> > Why do you talk about scrit? This is the Dev-C++ list, where people> normally uses Dev-C++ to write C or C++ applications. The traditional use> of the word 'script' is for some interpretative programming - often in a> batch file or similar.> > Anyway - is the file sorted? Does it contain a huge number of words?> > If no to any of the above two questions: Open file. Read one line into a> buffer (for example with fgets()). Find the first separator character> (space, tab or whatever the file is using). Replace the separator with a> '\0'; Compare start of line with the word you want to match. If no match,> load next line and repeat. If match, step past the separator and then eath> any more separator characters. Locate the '\n' at end of the read line,> and replace with a '\0'; Emit the extracted answer.> > If the file is huge and sorted, get the file size. Move to the middle of> the file. Read one (possibly partial line). Read the next line. Extract> the word and see if you are above/below the requested language. If you> found the word - extract answer. If word too large, move back to one> quarter of the file and repat. If word was too small, seek to 75% of file> and repeat. All the time remember the <min,max> range that the> expected word must be in. Note that <min> and <max> should represent the> start position of text lines, (or the end-of-file) so when you> specify <min> as seek offset, you do not have to thow away any> potentially partial text lines - you know that it is a full line> and can check that word immediately.> > /pwm> > On Tue, 3 Jun 2008, Alexsandro Meireles wrote:> > > Dear users,> >> > How can I write a script to look a word in a .txt file with two columns (one is the word and the other is the answer I need) and give an answer which is in the second column. In other words, a user types a word, then the script match it with a word in a .txt file (first column) and gives the answer (second column).> >> > Thanks in advance!> >> > Alex.> > _________________________________________________________________> > Cansado de espa?o para s? 50 fotos? Conhe?a o Spaces, o site de relacionamentos com at? 6,000 fotos!> > http://www.amigosdomessenger.com.br> > > > > ------------------------------> > Message: 7> Date: Tue, 3 Jun 2008 10:33:12 +0200 (CEST)> From: Per Westermark <pw...@ia...>> Subject: Re: [Dev-C++] Choose a word from a .txt file> To: Lloyd <ll...@cd...>> Cc: Alexsandro Meireles <ale...@ho...>,> dev...@li...> Message-ID:> <Pin...@ia...>> Content-Type: TEXT/PLAIN; charset=US-ASCII> > No regular expressions if he is looking for an exact match. Regular> expressions are there to look for patterns. Normal strcmp()/strncmp() is> faster when looking for exact matches.> > /pwm> > On Tue, 3 Jun 2008, Lloyd wrote:> > > Wouldn't regular expression search help you? May be better solution> > could be there...> >> > check for regex in www.boost.org> >> >> > On Tue, 2008-06-03 at 01:24 -0300, Alexsandro Meireles wrote:> > > Dear users,> > >> > > How can I write a script to look a word in a .txt file with two> > > columns (one is the word and the other is the answer I need) and give> > > an answer which is in the second column. In other words, a user types> > > a word, then the script match it with a word in a .txt file (first> > > column) and gives the answer (second column).> > >> > > Thanks in advance!> > >> > > Alex.> > >> >> >> >> > ______________________________________> > Scanned and protected by Email scanner> >> > -------------------------------------------------------------------------> > This SF.net email is sponsored by: Microsoft> > Defy all challenges. Microsoft(R) Visual Studio 2008.> > 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> >> > > > > ------------------------------> > -------------------------------------------------------------------------> This SF.net email is sponsored by: Microsoft> Defy all challenges. Microsoft(R) Visual Studio 2008.> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/> > ------------------------------> > _______________________________________________> Dev-cpp-users mailing list> Dev...@li...> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users> > > End of Dev-cpp-users Digest, Vol 25, Issue 1> ******************************************** > _________________________________________________________________ > Receba GRÁTIS as mensagens do Messenger no seu celular quando você estiver offline. Conheça o MSN Mobile! > http://mobile.live.com/signup/signup2.aspx?lc=pt-br |
From: Alexsandro M. <ale...@ho...> - 2008-06-03 15:57:27
|
Thank you all for helping me out. > From: dev...@li...> Subject: Dev-cpp-users Digest, Vol 25, Issue 1> To: dev...@li...> Date: Tue, 3 Jun 2008 01:33:27 -0700> > Send Dev-cpp-users mailing list submissions to> dev...@li...> > To subscribe or unsubscribe via the World Wide Web, visit> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users> or, via email, send a message with subject or body 'help' to> dev...@li...> > You can reach the person managing the list at> dev...@li...> > When replying, please edit your Subject line so it is more specific> than "Re: Contents of Dev-cpp-users digest..."> > > Today's Topics:> > 1. Re: templates + linker error (Per Westermark)> 2. Re: templates + linker error (Jorge Guevara)> 3. Re: templates + linker error (Per Westermark)> 4. Choose a word from a .txt file (Alexsandro Meireles)> 5. Re: Choose a word from a .txt file (Lloyd)> 6. Re: Choose a word from a .txt file (Per Westermark)> 7. Re: Choose a word from a .txt file (Per Westermark)> > > ----------------------------------------------------------------------> > Message: 1> Date: Mon, 26 May 2008 20:12:24 +0200 (CEST)> From: Per Westermark <pw...@ia...>> Subject: Re: [Dev-C++] templates + linker error> To: Lloyd <ll...@cd...>> Cc: dev...@li...> Message-ID:> <Pin...@ia...>> Content-Type: TEXT/PLAIN; charset=US-ASCII> > Think a bit about it.> > What code to you suggest that the compiler should enerate when it compiles> calc.cpp? If the compiler does not know that other source files will use> the template parameter "double", how will the compiler then be able to add> a "double" version of multiply when it compiles calc.cpp?> > Remember that it is the compiler, not the linker, that produces the> runnable code. The linker will have no use for an object file that doesn't> contain instantiated template functions.> > /pwm> > On Mon, 26 May 2008, Lloyd wrote:> > > The reason for the error is you are not passing the obj file of calc.cpp> > to the linker. Make appropriate settings in DevCpp. I think, you have to> > add calc.cpp to your project. Sorry I dont use DevCpp.> >> >> > On Sun, 2008-05-25 at 16:42 -0500, Jorge Guevara wrote:> > >> > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it> > > with devcpp)> > >> > > i have this error:> > > In function `main':> > > [Linker error] undefined reference to `calc<double>::multiply(double,> > > double)'> > > ld returned 1 exit status> > > [Build Error] ["Proyecto] Error 1> > >> > > somebody could help me please :)> > >> > > /********calc.h******/> > > #ifndef _CALC_H> > > #define _CALC_H> > >> > > template <class A_Type> class calc> > > {> > > public:> > > A_Type multiply(A_Type x, A_Type y);> > > A_Type add(A_Type x, A_Type y);> > >> > > };> > >> > > #endif> > >> > > /****calc.cpp******/> > > #include "calc.h"> > > #include <iostream>> > > using namespace std;> > >> > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type> > > y)> > > {> > > return x*y;> > > }> > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y)> > > {> > > return x+y;> > > }> > >> > >> > > /******principal.cpp*****/> > > #include "calc.h"> > > #include <iostream>> > > #include <cstdlib>> > >> > > using namespace std;> > >> > > int main()> > > {> > > calc <double> a_calc_class;> > > double a, b;> > > a=4.3;> > > b=3.4;> > > a_calc_class.multiply(a,b);> > >> > > system("PAUSE");> > > return EXIT_SUCCESS;> > > }> > > /***************************/> > >> > >> > > -------------------------------------------------------------------------> > > This SF.net email is sponsored by: Microsoft> > > Defy all challenges. Microsoft(R) Visual Studio 2008.> > > 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> >> >> > ______________________________________> > Scanned and protected by Email scanner> >> > -------------------------------------------------------------------------> > This SF.net email is sponsored by: Microsoft> > Defy all challenges. Microsoft(R) Visual Studio 2008.> > 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> >> > > > > ------------------------------> > Message: 2> Date: Tue, 27 May 2008 15:17:27 -0500> From: "Jorge Guevara" <jor...@gm...>> Subject: Re: [Dev-C++] templates + linker error> To: "Per Westermark" <pw...@ia...>> Cc: dev...@li...> Message-ID:> <51a...@ma...>> Content-Type: text/plain; charset="iso-8859-1"> > I try with this. and no problem> > #include <iostream>> #include <cstdlib>> #include "mypair.hpp"> #include "mypair.cpp" // i include the implementation in the source> principal.cpp> > the question is less efficient?, or its ok?> > bytes> > > 2008/5/26, Per Westermark <pw...@ia...>:> >> > The compiler can't create the code for a template function unless it sees> > the implementation when you try to use the template function.> >> > You should have the implementation of your multiply function in the header> > file, and not hidden in a cpp file.> >> > It is only the linker that will see the generated code from multiple cpp> > files, and neither the compiler nor the compiler knows that calc.cpp> > should create a specific version of the multiply function with the double> > data type.> >> > /pwm> >> >> > On Sun, 25 May 2008, Jorge Guevara wrote:> >> > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it with> > > devcpp)> > >> > > i have this error:> > > In function `main':> > > [Linker error] undefined reference to `calc<double>::multiply(double,> > > double)'> > > ld returned 1 exit status> > > [Build Error] ["Proyecto] Error 1> > >> > > somebody could help me please :)> > >> > > /********calc.h******/> > > #ifndef _CALC_H> > > #define _CALC_H> > >> > > template <class A_Type> class calc> > > {> > > public:> > > A_Type multiply(A_Type x, A_Type y);> > > A_Type add(A_Type x, A_Type y);> > >> > > };> > >> > > #endif> > >> > > /****calc.cpp******/> > > #include "calc.h"> > > #include <iostream>> > > using namespace std;> > >> > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type y)> > > {> > > return x*y;> > > }> > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y)> > > {> > > return x+y;> > > }> > >> > >> > > /******principal.cpp*****/> > > #include "calc.h"> > > #include <iostream>> > > #include <cstdlib>> > >> > > using namespace std;> > >> > > int main()> > > {> > > calc <double> a_calc_class;> > > double a, b;> > > a=4.3;> > > b=3.4;> > > a_calc_class.multiply(a,b);> > >> > > system("PAUSE");> > > return EXIT_SUCCESS;> > > }> > > /***************************/> > >> >> >> > > -- > Ing. Jorge Luis Guevara Diaz> Bs Ciencias de la Computacion> Maestrante en Ciencia de la Computaci?n> http://jorge.sistemasyservidores.com http://inf.unitru.edu.pe/~jlgd> Escuela de Inform?tica - Universidad Nacional de Trujillo> Escuela de Ingenier?a de Sistemas - Universidad Privada del Norte> -------------- next part --------------> An HTML attachment was scrubbed...> > ------------------------------> > Message: 3> Date: Wed, 28 May 2008 06:36:29 +0200 (CEST)> From: Per Westermark <pw...@ia...>> Subject: Re: [Dev-C++] templates + linker error> To: Jorge Guevara <jor...@gm...>> Cc: dev...@li...> Message-ID:> <Pin...@ia...>> Content-Type: TEXT/PLAIN; charset=ISO-8859-1> > Always avoid including cpp files. cpp files are indented to generate> object files and be linked.> > Templated functions are intended to be compiled into object files first> when needed. As I wrote in one of my earlier mails, template functions> should be placed in the relevant header file.> > Look at the STL files: In all cases, the actual source code> for the implementations of lists, trees, arrays etc are available in the> header files.> > /pwm> > On Tue, 27 May 2008, Jorge Guevara wrote:> > > I try with this. and no problem> >> > #include <iostream>> > #include <cstdlib>> > #include "mypair.hpp"> > #include "mypair.cpp" // i include the implementation in the source> > principal.cpp> >> > the question is less efficient?, or its ok?> >> > bytes> >> >> > 2008/5/26, Per Westermark <pw...@ia...>:> > >> > > The compiler can't create the code for a template function unless it sees> > > the implementation when you try to use the template function.> > >> > > You should have the implementation of your multiply function in the header> > > file, and not hidden in a cpp file.> > >> > > It is only the linker that will see the generated code from multiple cpp> > > files, and neither the compiler nor the compiler knows that calc.cpp> > > should create a specific version of the multiply function with the double> > > data type.> > >> > > /pwm> > >> > >> > > On Sun, 25 May 2008, Jorge Guevara wrote:> > >> > > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it with> > > > devcpp)> > > >> > > > i have this error:> > > > In function `main':> > > > [Linker error] undefined reference to `calc<double>::multiply(double,> > > > double)'> > > > ld returned 1 exit status> > > > [Build Error] ["Proyecto] Error 1> > > >> > > > somebody could help me please :)> > > >> > > > /********calc.h******/> > > > #ifndef _CALC_H> > > > #define _CALC_H> > > >> > > > template <class A_Type> class calc> > > > {> > > > public:> > > > A_Type multiply(A_Type x, A_Type y);> > > > A_Type add(A_Type x, A_Type y);> > > >> > > > };> > > >> > > > #endif> > > >> > > > /****calc.cpp******/> > > > #include "calc.h"> > > > #include <iostream>> > > > using namespace std;> > > >> > > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type y)> > > > {> > > > return x*y;> > > > }> > > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y)> > > > {> > > > return x+y;> > > > }> > > >> > > >> > > > /******principal.cpp*****/> > > > #include "calc.h"> > > > #include <iostream>> > > > #include <cstdlib>> > > >> > > > using namespace std;> > > >> > > > int main()> > > > {> > > > calc <double> a_calc_class;> > > > double a, b;> > > > a=4.3;> > > > b=3.4;> > > > a_calc_class.multiply(a,b);> > > >> > > > system("PAUSE");> > > > return EXIT_SUCCESS;> > > > }> > > > /***************************/> > > >> > >> > >> >> >> > --> > Ing. Jorge Luis Guevara Diaz> > Bs Ciencias de la Computacion> > Maestrante en Ciencia de la Computaci?n> > http://jorge.sistemasyservidores.com http://inf.unitru.edu.pe/~jlgd> > Escuela de Inform?tica - Universidad Nacional de Trujillo> > Escuela de Ingenier?a de Sistemas - Universidad Privada del Norte> >> > > > > ------------------------------> > Message: 4> Date: Tue, 3 Jun 2008 01:24:13 -0300> From: Alexsandro Meireles <ale...@ho...>> Subject: [Dev-C++] Choose a word from a .txt file> To: <dev...@li...>> Message-ID: <BAY...@ph...l>> Content-Type: text/plain; charset="iso-8859-1"> > Dear users,> > How can I write a script to look a word in a .txt file with two columns (one is the word and the other is the answer I need) and give an answer which is in the second column. In other words, a user types a word, then the script match it with a word in a .txt file (first column) and gives the answer (second column).> > Thanks in advance!> > Alex.> _________________________________________________________________> Cansado de espa?o para s? 50 fotos? Conhe?a o Spaces, o site de relacionamentos com at? 6,000 fotos!> http://www.amigosdomessenger.com.br> -------------- next part --------------> An HTML attachment was scrubbed...> > ------------------------------> > Message: 5> Date: Tue, 03 Jun 2008 10:19:31 +0530> From: Lloyd <ll...@cd...>> Subject: Re: [Dev-C++] Choose a word from a .txt file> To: Alexsandro Meireles <ale...@ho...>> Cc: dev...@li...> Message-ID: <1212468571.3808.1.camel@RCCF025>> Content-Type: text/plain> > Wouldn't regular expression search help you? May be better solution> could be there...> > check for regex in www.boost.org> > > On Tue, 2008-06-03 at 01:24 -0300, Alexsandro Meireles wrote:> > Dear users,> > > > How can I write a script to look a word in a .txt file with two> > columns (one is the word and the other is the answer I need) and give> > an answer which is in the second column. In other words, a user types> > a word, then the script match it with a word in a .txt file (first> > column) and gives the answer (second column).> > > > Thanks in advance!> > > > Alex.> > > > > > ______________________________________> Scanned and protected by Email scanner> > > > ------------------------------> > Message: 6> Date: Tue, 3 Jun 2008 10:31:54 +0200 (CEST)> From: Per Westermark <pw...@ia...>> Subject: Re: [Dev-C++] Choose a word from a .txt file> To: Alexsandro Meireles <ale...@ho...>> Cc: dev...@li...> Message-ID:> <Pin...@ia...>> Content-Type: TEXT/PLAIN; charset=ISO-8859-1> > Why do you talk about scrit? This is the Dev-C++ list, where people> normally uses Dev-C++ to write C or C++ applications. The traditional use> of the word 'script' is for some interpretative programming - often in a> batch file or similar.> > Anyway - is the file sorted? Does it contain a huge number of words?> > If no to any of the above two questions: Open file. Read one line into a> buffer (for example with fgets()). Find the first separator character> (space, tab or whatever the file is using). Replace the separator with a> '\0'; Compare start of line with the word you want to match. If no match,> load next line and repeat. If match, step past the separator and then eath> any more separator characters. Locate the '\n' at end of the read line,> and replace with a '\0'; Emit the extracted answer.> > If the file is huge and sorted, get the file size. Move to the middle of> the file. Read one (possibly partial line). Read the next line. Extract> the word and see if you are above/below the requested language. If you> found the word - extract answer. If word too large, move back to one> quarter of the file and repat. If word was too small, seek to 75% of file> and repeat. All the time remember the <min,max> range that the> expected word must be in. Note that <min> and <max> should represent the> start position of text lines, (or the end-of-file) so when you> specify <min> as seek offset, you do not have to thow away any> potentially partial text lines - you know that it is a full line> and can check that word immediately.> > /pwm> > On Tue, 3 Jun 2008, Alexsandro Meireles wrote:> > > Dear users,> >> > How can I write a script to look a word in a .txt file with two columns (one is the word and the other is the answer I need) and give an answer which is in the second column. In other words, a user types a word, then the script match it with a word in a .txt file (first column) and gives the answer (second column).> >> > Thanks in advance!> >> > Alex.> > _________________________________________________________________> > Cansado de espa?o para s? 50 fotos? Conhe?a o Spaces, o site de relacionamentos com at? 6,000 fotos!> > http://www.amigosdomessenger.com.br> > > > > ------------------------------> > Message: 7> Date: Tue, 3 Jun 2008 10:33:12 +0200 (CEST)> From: Per Westermark <pw...@ia...>> Subject: Re: [Dev-C++] Choose a word from a .txt file> To: Lloyd <ll...@cd...>> Cc: Alexsandro Meireles <ale...@ho...>,> dev...@li...> Message-ID:> <Pin...@ia...>> Content-Type: TEXT/PLAIN; charset=US-ASCII> > No regular expressions if he is looking for an exact match. Regular> expressions are there to look for patterns. Normal strcmp()/strncmp() is> faster when looking for exact matches.> > /pwm> > On Tue, 3 Jun 2008, Lloyd wrote:> > > Wouldn't regular expression search help you? May be better solution> > could be there...> >> > check for regex in www.boost.org> >> >> > On Tue, 2008-06-03 at 01:24 -0300, Alexsandro Meireles wrote:> > > Dear users,> > >> > > How can I write a script to look a word in a .txt file with two> > > columns (one is the word and the other is the answer I need) and give> > > an answer which is in the second column. In other words, a user types> > > a word, then the script match it with a word in a .txt file (first> > > column) and gives the answer (second column).> > >> > > Thanks in advance!> > >> > > Alex.> > >> >> >> >> > ______________________________________> > Scanned and protected by Email scanner> >> > -------------------------------------------------------------------------> > This SF.net email is sponsored by: Microsoft> > Defy all challenges. Microsoft(R) Visual Studio 2008.> > 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> >> > > > > ------------------------------> > -------------------------------------------------------------------------> This SF.net email is sponsored by: Microsoft> Defy all challenges. Microsoft(R) Visual Studio 2008.> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/> > ------------------------------> > _______________________________________________> Dev-cpp-users mailing list> Dev...@li...> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users> > > End of Dev-cpp-users Digest, Vol 25, Issue 1> ******************************************** _________________________________________________________________ Receba GRÁTIS as mensagens do Messenger no seu celular quando você estiver offline. Conheça o MSN Mobile! http://mobile.live.com/signup/signup2.aspx?lc=pt-br |
From: Sandip N. <tec...@gm...> - 2008-06-03 15:36:09
|
I have installed Dev-cpp on my computer and practising C++ programs. But what is annoying me is that I have to use a <conio.h> header with the .h extension. Moreover, a getch() function is to written at the end of every program.Otherwise no dispaly is shown. Why is ths happening? Why i have to use the conio with the .h extension everytime? MinGw is the compiler(default) on my computer. Plz help me out. |
From: Per W. <pw...@ia...> - 2008-06-03 12:12:31
|
The question here isn't the number of source lines to perform the job. Why? Because you don't need any source lines at all if you just use normal unix-available tools - you can get an answer directly on the command line. But this is a C/C++ mailling list, since it is about Dev-C++. So the question should then be: How to actually perform the job (instead of letting existing command-line tools do it) in C/C++ source code. If you have a nail: should you use a hammer or a sledge hammer? Or maybe you should blast it into the pnak with dynamite? The Hilti nail-guns goes the explosive way, but with the disadvantage that it doesn't leave much for a DIY guy. Calling a magic reg-exp library doesn't tell someone what is happening. Reg-exp is cool, but regular expressions are meant to perform pattern matching. You don't have much need for any pattern matching in this case - and more importantly, you are ignoring how to solve the problem since you let someone else solve it for you. Next step: You compalin about my tree algorithm.I did suggest both a linear approach and a tree algorithm, mentioning the tree algorithm for large sorted files. If you have one billion words, the text file may be 100 billion bytes large. Guess how fast your reg-exp scan of the full file would be. Guess what would happen when a tree algorithm cuts it in two for each iterative step? A naive implementation would solve for one billion words in max 30 tests. A slightly better approach (switching from tree to linear when you have narrowed it down to a block of maybe a couple of kB of data - matched to n * block size for file system or memory subsystem. Now, assume 20MB/s for the regexp solution, and 0.1s/scan for the tree search. On average, the regexp would then need 25 000 seconds on average (twice in worst-case), while the tree search would take <= 3 seconds worst-case. Hence, the simplest code doesn't always win - you must know what your requirements are before you can select a good (or almost always a "good enough") algorithm. Anyway - please compare runtime and size of application binary for a compiled regexp solution, as compared with the following: void scan(char* my_word) { char tmp_match[MAX_WORD_LEN+10]; char linebuf[MAX_LINE_LEN],*p1,*p2; int match_len,found = 0; FILE *f; match_len = strlen(my_word); strcpy(tmp_match,my_word); strcpy(tmp_match+match_len++," "); f = fopen(fname,"rt"); if (f) { while (fgets(linebuf,sizeof(linebuf),f)) { if (!strncmp(linebuf,tmp_match,match_len)) { p1 = linebuf + match_len; while (*p1 == ' ') p1++; p2 = strchr(p1,'\n'); if (p2) *p2 = '\0'; printf("Answer for %s: %s\n",my_word,p1); found = 1; break; } } fclose(f); if (!found) printf("No match found for %s\n",my_word); } else { printf("Failed opening text file\n"); } } Note: A real implementation should call setbuffer() or setvbuf() or alternatively use ioctl() or similar and specify one-pass read-only scan without seek. But that isn't part of a search algorithm. /pwm On Tue, 3 Jun 2008, "Münt, Bernd" wrote: > > No regular expressions if he is looking for an exact match. Regular > > expressions are there to look for patterns. Normal > > strcmp()/strncmp() is > > faster when looking for exact matches. > > No not at all. You explained an algorithms to look in the middle, then depending on less or greater in the lower half or in the upper half etc. That needs a lot of lookups if the file is huge. > > A regex with the multiline option can find the answer with one line. > /^WordToFind\s*?(.*)/m > In the caption(1) you will find the answer, if there is an answer. > > Regards, BM > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > 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: Pranav N. <pr...@pr...> - 2008-06-03 09:44:28
|
I think what Per refers to is the overhead of initializing and regex library and calling upon it. What appears as a single function call is probably several 100 lines of code underneath. And for small programs it's often better to leave out library dependencies and reduce compilation times. Just my 2 cents. Pranav Negandhi www.pranavnegandhi.com >> No regular expressions if he is looking for an exact match. Regular >> expressions are there to look for patterns. Normal >> strcmp()/strncmp() is >> faster when looking for exact matches. > > No not at all. You explained an algorithms to look in the middle, then > depending on less or greater in the lower half or in the upper half etc. > That needs a lot of lookups if the file is huge. > > A regex with the multiline option can find the answer with one line. > /^WordToFind\s*?(.*)/m > In the caption(1) you will find the answer, if there is an answer. > |
From: Münt, B. <Ber...@eu...> - 2008-06-03 09:35:37
|
> No regular expressions if he is looking for an exact match. Regular > expressions are there to look for patterns. Normal > strcmp()/strncmp() is > faster when looking for exact matches. No not at all. You explained an algorithms to look in the middle, then depending on less or greater in the lower half or in the upper half etc. That needs a lot of lookups if the file is huge. A regex with the multiline option can find the answer with one line. /^WordToFind\s*?(.*)/m In the caption(1) you will find the answer, if there is an answer. Regards, BM |
From: Per W. <pw...@ia...> - 2008-06-03 08:33:26
|
No regular expressions if he is looking for an exact match. Regular expressions are there to look for patterns. Normal strcmp()/strncmp() is faster when looking for exact matches. /pwm On Tue, 3 Jun 2008, Lloyd wrote: > Wouldn't regular expression search help you? May be better solution > could be there... > > check for regex in www.boost.org > > > On Tue, 2008-06-03 at 01:24 -0300, Alexsandro Meireles wrote: > > Dear users, > > > > How can I write a script to look a word in a .txt file with two > > columns (one is the word and the other is the answer I need) and give > > an answer which is in the second column. In other words, a user types > > a word, then the script match it with a word in a .txt file (first > > column) and gives the answer (second column). > > > > Thanks in advance! > > > > Alex. > > > > > > ______________________________________ > Scanned and protected by Email scanner > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > 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: Per W. <pw...@ia...> - 2008-06-03 08:32:09
|
Why do you talk about scrit? This is the Dev-C++ list, where people normally uses Dev-C++ to write C or C++ applications. The traditional use of the word 'script' is for some interpretative programming - often in a batch file or similar. Anyway - is the file sorted? Does it contain a huge number of words? If no to any of the above two questions: Open file. Read one line into a buffer (for example with fgets()). Find the first separator character (space, tab or whatever the file is using). Replace the separator with a '\0'; Compare start of line with the word you want to match. If no match, load next line and repeat. If match, step past the separator and then eath any more separator characters. Locate the '\n' at end of the read line, and replace with a '\0'; Emit the extracted answer. If the file is huge and sorted, get the file size. Move to the middle of the file. Read one (possibly partial line). Read the next line. Extract the word and see if you are above/below the requested language. If you found the word - extract answer. If word too large, move back to one quarter of the file and repat. If word was too small, seek to 75% of file and repeat. All the time remember the <min,max> range that the expected word must be in. Note that <min> and <max> should represent the start position of text lines, (or the end-of-file) so when you specify <min> as seek offset, you do not have to thow away any potentially partial text lines - you know that it is a full line and can check that word immediately. /pwm On Tue, 3 Jun 2008, Alexsandro Meireles wrote: > Dear users, > > How can I write a script to look a word in a .txt file with two columns (one is the word and the other is the answer I need) and give an answer which is in the second column. In other words, a user types a word, then the script match it with a word in a .txt file (first column) and gives the answer (second column). > > Thanks in advance! > > Alex. > _________________________________________________________________ > Cansado de espaço para só 50 fotos? Conheça o Spaces, o site de relacionamentos com até 6,000 fotos! > http://www.amigosdomessenger.com.br |
From: Lloyd <ll...@cd...> - 2008-06-03 04:47:10
|
Wouldn't regular expression search help you? May be better solution could be there... check for regex in www.boost.org On Tue, 2008-06-03 at 01:24 -0300, Alexsandro Meireles wrote: > Dear users, > > How can I write a script to look a word in a .txt file with two > columns (one is the word and the other is the answer I need) and give > an answer which is in the second column. In other words, a user types > a word, then the script match it with a word in a .txt file (first > column) and gives the answer (second column). > > Thanks in advance! > > Alex. > ______________________________________ Scanned and protected by Email scanner |
From: Alexsandro M. <ale...@ho...> - 2008-06-03 04:24:23
|
Dear users, How can I write a script to look a word in a .txt file with two columns (one is the word and the other is the answer I need) and give an answer which is in the second column. In other words, a user types a word, then the script match it with a word in a .txt file (first column) and gives the answer (second column). Thanks in advance! Alex. _________________________________________________________________ Cansado de espaço para só 50 fotos? Conheça o Spaces, o site de relacionamentos com até 6,000 fotos! http://www.amigosdomessenger.com.br |
From: Per W. <pw...@ia...> - 2008-05-28 04:36:42
|
Always avoid including cpp files. cpp files are indented to generate object files and be linked. Templated functions are intended to be compiled into object files first when needed. As I wrote in one of my earlier mails, template functions should be placed in the relevant header file. Look at the STL files: In all cases, the actual source code for the implementations of lists, trees, arrays etc are available in the header files. /pwm On Tue, 27 May 2008, Jorge Guevara wrote: > I try with this. and no problem > > #include <iostream> > #include <cstdlib> > #include "mypair.hpp" > #include "mypair.cpp" // i include the implementation in the source > principal.cpp > > the question is less efficient?, or its ok? > > bytes > > > 2008/5/26, Per Westermark <pw...@ia...>: > > > > The compiler can't create the code for a template function unless it sees > > the implementation when you try to use the template function. > > > > You should have the implementation of your multiply function in the header > > file, and not hidden in a cpp file. > > > > It is only the linker that will see the generated code from multiple cpp > > files, and neither the compiler nor the compiler knows that calc.cpp > > should create a specific version of the multiply function with the double > > data type. > > > > /pwm > > > > > > On Sun, 25 May 2008, Jorge Guevara wrote: > > > > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it with > > > devcpp) > > > > > > i have this error: > > > In function `main': > > > [Linker error] undefined reference to `calc<double>::multiply(double, > > > double)' > > > ld returned 1 exit status > > > [Build Error] ["Proyecto] Error 1 > > > > > > somebody could help me please :) > > > > > > /********calc.h******/ > > > #ifndef _CALC_H > > > #define _CALC_H > > > > > > template <class A_Type> class calc > > > { > > > public: > > > A_Type multiply(A_Type x, A_Type y); > > > A_Type add(A_Type x, A_Type y); > > > > > > }; > > > > > > #endif > > > > > > /****calc.cpp******/ > > > #include "calc.h" > > > #include <iostream> > > > using namespace std; > > > > > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type y) > > > { > > > return x*y; > > > } > > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y) > > > { > > > return x+y; > > > } > > > > > > > > > /******principal.cpp*****/ > > > #include "calc.h" > > > #include <iostream> > > > #include <cstdlib> > > > > > > using namespace std; > > > > > > int main() > > > { > > > calc <double> a_calc_class; > > > double a, b; > > > a=4.3; > > > b=3.4; > > > a_calc_class.multiply(a,b); > > > > > > system("PAUSE"); > > > return EXIT_SUCCESS; > > > } > > > /***************************/ > > > > > > > > > > -- > Ing. Jorge Luis Guevara Diaz > Bs Ciencias de la Computacion > Maestrante en Ciencia de la Computación > http://jorge.sistemasyservidores.com http://inf.unitru.edu.pe/~jlgd > Escuela de Informática - Universidad Nacional de Trujillo > Escuela de Ingeniería de Sistemas - Universidad Privada del Norte > |
From: Jorge G. <jor...@gm...> - 2008-05-27 20:17:32
|
I try with this. and no problem #include <iostream> #include <cstdlib> #include "mypair.hpp" #include "mypair.cpp" // i include the implementation in the source principal.cpp the question is less efficient?, or its ok? bytes 2008/5/26, Per Westermark <pw...@ia...>: > > The compiler can't create the code for a template function unless it sees > the implementation when you try to use the template function. > > You should have the implementation of your multiply function in the header > file, and not hidden in a cpp file. > > It is only the linker that will see the generated code from multiple cpp > files, and neither the compiler nor the compiler knows that calc.cpp > should create a specific version of the multiply function with the double > data type. > > /pwm > > > On Sun, 25 May 2008, Jorge Guevara wrote: > > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it with > > devcpp) > > > > i have this error: > > In function `main': > > [Linker error] undefined reference to `calc<double>::multiply(double, > > double)' > > ld returned 1 exit status > > [Build Error] ["Proyecto] Error 1 > > > > somebody could help me please :) > > > > /********calc.h******/ > > #ifndef _CALC_H > > #define _CALC_H > > > > template <class A_Type> class calc > > { > > public: > > A_Type multiply(A_Type x, A_Type y); > > A_Type add(A_Type x, A_Type y); > > > > }; > > > > #endif > > > > /****calc.cpp******/ > > #include "calc.h" > > #include <iostream> > > using namespace std; > > > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type y) > > { > > return x*y; > > } > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y) > > { > > return x+y; > > } > > > > > > /******principal.cpp*****/ > > #include "calc.h" > > #include <iostream> > > #include <cstdlib> > > > > using namespace std; > > > > int main() > > { > > calc <double> a_calc_class; > > double a, b; > > a=4.3; > > b=3.4; > > a_calc_class.multiply(a,b); > > > > system("PAUSE"); > > return EXIT_SUCCESS; > > } > > /***************************/ > > > > -- Ing. Jorge Luis Guevara Diaz Bs Ciencias de la Computacion Maestrante en Ciencia de la Computación http://jorge.sistemasyservidores.com http://inf.unitru.edu.pe/~jlgd Escuela de Informática - Universidad Nacional de Trujillo Escuela de Ingeniería de Sistemas - Universidad Privada del Norte |
From: Per W. <pw...@ia...> - 2008-05-26 18:57:18
|
Think a bit about it. What code to you suggest that the compiler should enerate when it compiles calc.cpp? If the compiler does not know that other source files will use the template parameter "double", how will the compiler then be able to add a "double" version of multiply when it compiles calc.cpp? Remember that it is the compiler, not the linker, that produces the runnable code. The linker will have no use for an object file that doesn't contain instantiated template functions. /pwm On Mon, 26 May 2008, Lloyd wrote: > The reason for the error is you are not passing the obj file of calc.cpp > to the linker. Make appropriate settings in DevCpp. I think, you have to > add calc.cpp to your project. Sorry I dont use DevCpp. > > > On Sun, 2008-05-25 at 16:42 -0500, Jorge Guevara wrote: > > > > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it > > with devcpp) > > > > i have this error: > > In function `main': > > [Linker error] undefined reference to `calc<double>::multiply(double, > > double)' > > ld returned 1 exit status > > [Build Error] ["Proyecto] Error 1 > > > > somebody could help me please :) > > > > /********calc.h******/ > > #ifndef _CALC_H > > #define _CALC_H > > > > template <class A_Type> class calc > > { > > public: > > A_Type multiply(A_Type x, A_Type y); > > A_Type add(A_Type x, A_Type y); > > > > }; > > > > #endif > > > > /****calc.cpp******/ > > #include "calc.h" > > #include <iostream> > > using namespace std; > > > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type > > y) > > { > > return x*y; > > } > > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y) > > { > > return x+y; > > } > > > > > > /******principal.cpp*****/ > > #include "calc.h" > > #include <iostream> > > #include <cstdlib> > > > > using namespace std; > > > > int main() > > { > > calc <double> a_calc_class; > > double a, b; > > a=4.3; > > b=3.4; > > a_calc_class.multiply(a,b); > > > > system("PAUSE"); > > return EXIT_SUCCESS; > > } > > /***************************/ > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > 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 > > > ______________________________________ > Scanned and protected by Email scanner > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > 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: Per W. <pw...@ia...> - 2008-05-26 16:40:39
|
The compiler can't create the code for a template function unless it sees the implementation when you try to use the template function. You should have the implementation of your multiply function in the header file, and not hidden in a cpp file. It is only the linker that will see the generated code from multiple cpp files, and neither the compiler nor the compiler knows that calc.cpp should create a specific version of the multiply function with the double data type. /pwm On Sun, 25 May 2008, Jorge Guevara wrote: > i have 3 source calc.h calc.cpp and principal.cpp (i compilated it with > devcpp) > > i have this error: > In function `main': > [Linker error] undefined reference to `calc<double>::multiply(double, > double)' > ld returned 1 exit status > [Build Error] ["Proyecto] Error 1 > > somebody could help me please :) > > /********calc.h******/ > #ifndef _CALC_H > #define _CALC_H > > template <class A_Type> class calc > { > public: > A_Type multiply(A_Type x, A_Type y); > A_Type add(A_Type x, A_Type y); > > }; > > #endif > > /****calc.cpp******/ > #include "calc.h" > #include <iostream> > using namespace std; > > template <class A_Type> A_Type calc<A_Type>::multiply(A_Type x,A_Type y) > { > return x*y; > } > template <class A_Type> A_Type calc<A_Type>::add(A_Type x, A_Type y) > { > return x+y; > } > > > /******principal.cpp*****/ > #include "calc.h" > #include <iostream> > #include <cstdlib> > > using namespace std; > > int main() > { > calc <double> a_calc_class; > double a, b; > a=4.3; > b=3.4; > a_calc_class.multiply(a,b); > > system("PAUSE"); > return EXIT_SUCCESS; > } > /***************************/ > |