RE: [Dev-C++] How to work with *.txt files??
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Todd G. <pi...@ea...> - 2004-09-19 04:01:54
|
Hello,
When I run the program that shown below I receive the following compiler
output. I running dev-C++ version 4.9.8.0 on Windows 2000.
Thanks for any ideas,
Todd
Compiler: Default compiler
Building Makefile: "E:\dev\cpp\devcpp\test\Makefile.win"
Executing make...
make.exe -f "E:\dev\cpp\devcpp\test\Makefile.win" all
g++.exe -c main.cpp -o
ain.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/
Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include" main.cpp: In
function `void strings_test()':
main.cpp:15: `list' undeclared (first use this function) main.cpp:15: (Each
undeclared identifier is reported only once for each
function it appears in.) main.cpp:15: parse error before `>' token
main.cpp:17: `foo' undeclared (first use this function) main.cpp: In
function `void int_test()':
main.cpp:26: parse error before `>' token make.exe: *** [main.o] Error 1
Execution terminated
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of Daniel K.
> O.
> Sent: Saturday, September 18, 2004 2:51 PM
> To: zw...@he...
> Cc: dev...@li...
> Subject: Re: [Dev-C++] How to work with *.txt files??
>
>
> ZwiQ wrote:
>
> > I assume that assigning pointers isn't as resourcesconsuming as
> > assigning strings?
>
>
> Most STL implementations (including GCC) provide an efficient way to
> copy a string. In Stroustrup's book he illustrates a basic string
> implementation this way.
> Try it youself:
>
> ----
> #include <string>
> #include <vector>
> #include <iostream>
>
> using namespace std;
>
> const int n = 10000000; // just any big number
>
> void strings_test()
> {
> cout << "Strings test, press enter to start" << endl;
> cin.ignore();
> string msg =
> "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm
> nopqrstuvwxyz";
> list<string> foo;
> for (int i=0; i<n; i++)
> foo.push_back(msg);
> cout << "Press enter to free " << n << " strings" << endl;
> cin.ignore();
> }
>
> void int_test()
> {
> cout << "Int test, press enter to start" << endl;
> cin.ignore();
> list<int> foo;
> for (int i=0; i<n; i++)
> foo.push_back(1);
> cout << "Press enter to free " << n << " numbers" << endl;
> cin.ignore();
> }
>
> int main()
> {
> strings_test();
> int_test();
> return 0;
> }
> ----
>
>
> While you execute this program, keep watching the memory your program
> consumes. You'll see that copying strings doesn't duplicate the data,
> they share the same representation until you change one of them. With
> this program you can also compare the size alocated by both the string
> list and an int list.
>
> Daniel K. O.
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.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
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of Daniel K.
> O.
> Sent: Saturday, September 18, 2004 2:51 PM
> To: zw...@he...
> Cc: dev...@li...
> Subject: Re: [Dev-C++] How to work with *.txt files??
>
>
> ZwiQ wrote:
>
> > I assume that assigning pointers isn't as resourcesconsuming as
> > assigning strings?
>
>
> Most STL implementations (including GCC) provide an efficient way to
> copy a string. In Stroustrup's book he illustrates a basic string
> implementation this way.
> Try it youself:
>
> ----
> #include <string>
> #include <vector>
> #include <iostream>
>
> using namespace std;
>
> const int n = 10000000; // just any big number
>
> void strings_test()
> {
> cout << "Strings test, press enter to start" << endl;
> cin.ignore();
> string msg =
> "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm
> nopqrstuvwxyz";
> list<string> foo;
> for (int i=0; i<n; i++)
> foo.push_back(msg);
> cout << "Press enter to free " << n << " strings" << endl;
> cin.ignore();
> }
>
> void int_test()
> {
> cout << "Int test, press enter to start" << endl;
> cin.ignore();
> list<int> foo;
> for (int i=0; i<n; i++)
> foo.push_back(1);
> cout << "Press enter to free " << n << " numbers" << endl;
> cin.ignore();
> }
>
> int main()
> {
> strings_test();
> int_test();
> return 0;
> }
> ----
>
>
> While you execute this program, keep watching the memory your program
> consumes. You'll see that copying strings doesn't duplicate the data,
> they share the same representation until you change one of them. With
> this program you can also compare the size alocated by both the string
> list and an int list.
>
> Daniel K. O.
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.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
|