dev-cpp-users Mailing List for Dev-C++ (Page 3)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
(9) |
2
(5) |
3
(7) |
4
(1) |
|
5
(1) |
6
(4) |
7
(8) |
8
(7) |
9
(10) |
10
(1) |
11
(7) |
|
12
(6) |
13
(6) |
14
(2) |
15
(8) |
16
(3) |
17
(2) |
18
(6) |
|
19
(6) |
20
|
21
(14) |
22
(5) |
23
|
24
(5) |
25
(5) |
|
26
(3) |
27
(12) |
28
(4) |
29
(4) |
30
(7) |
|
|
|
From: Youssouf N. <yn...@gm...> - 2004-09-21 08:05:49
|
I'm begining with hooks, and I think the way they work is a mystery. If someone had an example, I'll gladly accept it or any help. I've created a DLL containing the following hook callback function : __declspec( dllexport ) LRESULT CALLBACK myHookProc (int nCode, WPARAM wParam, LPARAM lParam); In this function, I'm logging events into a file, but no events are received. I've tried both adding a WH_KEYBOARD hook and a WH_KEYBOARD_LL hook but no one receives Keyboard Input. In the Win32 API, the last argument of SetWindowsHookEx must be zero in order to attach this hook to every running thread, and here is the way I call it : hook = SetWindowsHookEx(WH_KEYBOARD_LL, (HOOKPROC)hookproc, dllinst, 0); Thanks |
|
From: Wehrli, L. <we...@st...> - 2004-09-21 07:46:27
|
=20 Hi Scott, > In learning OpenGL, I have decided to write my own small wrapper class > that provides me basic funcitons like setting up a window and so forth > to speed up the learning process. I have begun to write the wrapper > class, but have several questions: Have a look at GLUT, that library offers functions for all the standart = window handling and interfacng stuff you normaly need. > 1. Can I span the class definition across multiple files, or must I > stich to the decleration in one .h file and the definition in a .cpp = file? You can use as many .cpp files as you want, but you can not span the = declaration of a class over several files. Consider that a class should = form an abstract entity that makes sense, i.e. all its member methods = and properties should somehow belong together. > 2. I have heard some people say you should only define one function = per > .cpp file in a library due to size issues. Is this true, and if so, is > it worth the added effort? I have never heard that. It doesn't matter for the compiler where a = function implemented or how many functions are implemented in a single = file. You can put in a .cpp file what ever you want. The question is = more: what makes sense? Usually the one .h and one .cpp per class is the = best choice. > 3. What is the level of documentation required for a basic wrapper > class? I stick to a header at the top of each file, function headers, > and in code comments. Will it be necessary to include any external > documentation at this point? That is greate. I wish I could force myself to this level of documentary = discipline. If the code is for your own use only, this should be more = than enough. > 4. Should I just use several functions in a namespace instead of a = class > to simplify the development process? Class vs namespace is not a question of simplification but of design = logic. If you hav several funtions which are often used together and/or = in conjunction you should use a namespace. If you have several functions = which work with the same data structures you might want to wrap the = functions and the data into a single class. BTW: A namespace CAN (and should) be spanned over several files. > 5. Are there any long term pros/cons associated with maintanence of a > class versus functions in a namespace? Can't think of one right now. I would use both anyway. Bye, Lior |
|
From: Scott S. <age...@co...> - 2004-09-21 01:17:04
|
In learning OpenGL, I have decided to write my own small wrapper class that provides me basic funcitons like setting up a window and so forth to speed up the learning process. I have begun to write the wrapper class, but have several questions: 1. Can I span the class definition across multiple files, or must I stich to the decleration in one .h file and the definition in a .cpp file? 2. I have heard some people say you should only define one function per .cpp file in a library due to size issues. Is this true, and if so, is it worth the added effort? 3. What is the level of documentation required for a basic wrapper class? I stick to a header at the top of each file, function headers, and in code comments. Will it be necessary to include any external documentation at this point? 4. Should I just use several functions in a namespace instead of a class to simplify the development process? 5. Are there any long term pros/cons associated with maintanence of a class versus functions in a namespace? Thank you in advanced for any advice you may have and answers to my questions. I have never done anything like this before, and want to make sure I do it correctly. -- --Scott Simontis-- |
|
From: Daniel K. O. <dan...@ya...> - 2004-09-19 20:39:22
|
I just forgot to mention, depending on what you want to do, you can use
signals. Obviously signals are used in a very different way than
exceptions, but may be useful if all you want is to dump some
information before the crash. See the example:
----
#include <iostream>
#include <csignal>
#include <cstdlib>
using namespace std;
void foo(int signum)
{
cout << "Program crashed... press enter to finish" << endl;
cin.ignore();
exit(EXIT_FAILURE);
}
int main()
{
signal(SIGSEGV, foo);
int *a = 0;
*a = 1;
return EXIT_SUCCESS;
}
----
But quoting ISO/IEC 9899:1999, page 245:
"An implementation need not generate any of these signals, except as a
result of explicit calls to the raise function. (...) The complete set
of signals, their semantics, and their default handling
is implementation-defined (...)."
Daniel K. O.
|
|
From: Daniel K. O. <dan...@ya...> - 2004-09-19 20:13:19
|
Daniel Monteiro Ferreira wrote: > I'm a DevC++ newbie and I'm still trying to get used to it. I wrote a > test program to see what happens if I try to access the contents of a > null pointer. I wrote the illegal access inside a try/catch block, but > instead of executing the catch block, the program simply shows an > error message and aborts. I set the code generation settings to enable > exception handling, but it didn't work. Can't this kind of error be > treated as an exception? If not, how can I keep my program from > aborting? I would apreciate if anybody helped me. Thanks! Exceptions are used to handle run-time "errors". Accessing an invalid address is solely a programming error. What could you possibly do if at one point in your program you access an invalid address? It means that your algorithm is wrong, and you lost the data you were trying to access. Daniel K. O. |
|
From: Daniel M. F. <dan...@ya...> - 2004-09-19 19:40:49
|
Hi! I'm a DevC++ newbie and I'm still trying to get used to it. I wrote a = test program to see what happens if I try to access the contents of a = null pointer. I wrote the illegal access inside a try/catch block, but = instead of executing the catch block, the program simply shows an error = message and aborts. I set the code generation settings to enable = exception handling, but it didn't work. Can't this kind of error be = treated as an exception? If not, how can I keep my program from = aborting? I would apreciate if anybody helped me. Thanks! Daniel Ferreira. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.764 / Virus Database: 511 - Release Date: 18/09/2004 |
|
From: Per W. <pw...@ia...> - 2004-09-19 11:31:06
|
Well, don't blame yourself. The human life is meant for learning :) Logically, there isn't a difference between a vector and an array. Vector is the mathematical term for a one-dimensional array, i.e. an array with a single index. The important thing about the stl template class vector is that it doesn't grow by one every time you add one element, which would have resulted in O(n^2) complexity. A typical implementation doubles the length of the vector, whenever it needs to grow. This makes sure that the reallocation times - on average - may be ignored, and the inserts will then run in constant amortized time, i.e. the _average_ insert will consume constant time. If the vector is 1,000,000 elements long - and full - and you try to add one more entry, it grows to a length of 2,000,000 resulting in the next one million inserts not needing any reallocation. It really doesn't matter if a string assign if efficient or not. The important thing to avoid - when possible - is algorithsms with exponential growth, since the total run time will start to escalate even for extremely fast operations. /Per W On Sat, 18 Sep 2004, ZwiQ wrote: > Per Westermark wrote: > > > <>Ouch. > > > > Don't do that. > > > > There is the vector template class in the stl. > > (Hielke blames himself for not reading a good C++ book himself :o) > > Hm, you're right. Thanks! I said I would use a vector but in the code I > did use an simple array. Now I think of it, the code I wrote down there > without good thinking was ment to store an array of pointers to strings, > not strings themselves. Used it mainly when I had to reorganize the > order of the stored strings with manipulation members (eg. sort). > I assume that assigning pointers isn't as resourcesconsuming as > assigning strings? However, you're still right about the complexity. > Vector operations themselves all are lineair? So I should use a vector > in that case too as well? > > Regards, > Hielke > Zw...@he... |
|
From: Daniel K. O. <dan...@ya...> - 2004-09-19 05:01:29
|
Todd Gardner wrote: >main.cpp:15: `list' undeclared (first use this function) main.cpp:15: (Each > > Sorry, I confused the headers; replace #include <vector> by #include <list> Daniel K. O. |
|
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
|
|
From: Daniel K. O. <dan...@ya...> - 2004-09-18 21:50:57
|
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 =
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
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.
|
|
From: ZwiQ <zw...@he...> - 2004-09-18 20:37:58
|
Per Westermark wrote:
> <>Ouch.
>
> Don't do that.
>
> There is the vector template class in the stl.
(Hielke blames himself for not reading a good C++ book himself :o)
Hm, you're right. Thanks! I said I would use a vector but in the code I
did use an simple array. Now I think of it, the code I wrote down there
without good thinking was ment to store an array of pointers to strings,
not strings themselves. Used it mainly when I had to reorganize the
order of the stored strings with manipulation members (eg. sort).
I assume that assigning pointers isn't as resourcesconsuming as
assigning strings? However, you're still right about the complexity.
Vector operations themselves all are lineair? So I should use a vector
in that case too as well?
Regards,
Hielke
Zw...@he...
> <>Do not write a method that reallocates all strings every time.
>
> First line - allocate one string.
> Second line - allocate two strings.
> Third line - allocate three strings.
> ...
>
> By doing this, you manage to transform a linear operation - proportional
> to number of lines in the file - to become O(n^2).
>
> If you open a 100,000 line file, you would perform 100,000^2 / 2 or
> 5,000,000,000 string assigns.
>
> Never add complexity when it isn't needed.
>
> std::vector<std::string> strings;
>
> and then
>
> strings.push_back(line);
>
> or
>
> strings.reserve(10);
> strings[n++] = line;
>
> is a lot nicer code, and tremendously much more efficient.
>
> /Per W
>
> On Sat, 18 Sep 2004, hielke_prins wrote:
>
>>>>How do I refer to each line of my *.txt file???
>>>>
>>>>
>>/*
>> If you don't have any clue how to read a simple textfile, the first
>>thing you
>> proably have to do is buying a good book on C(++). But here ya go.
>>
>> I usually read small plaintext files in a vector using a simple
>>wrapperclass.
>> Something like this (if you meant to write it in C++ at least),
>>didn't test it:
>>*/
>>
>>Class Lines
>>{
>> string *d_line;
>> unsigned d_nLines;
>>
>> public:
>> Lines(istream streamIn);
>> /*
>> (of course you need some simple memberfunctions
>> returning linecount and lines on a given index too)
>> */
>>}
>>
>>Lines::Lines(istream streamIn)
>>:
>> d_nLines(0)
>>{
>> string inputLine,
>> *tempLine;
>>
>> while(getline(streamIn, inputLine))
>> {
>> d_nLines++;
>> tempLine = new string[d_nLines];
>> for(unsigned i = 0; i < d_nLines; i++)
>> {
>> tempLine[i] = d_line[i];
>> }
>> delete d_line;
>> d_line = tempLine;
>> }
>>}
>>
>>Regards,
>> Hielke
>>
>>
>
>
>
>
|
|
From: Per W. <pw...@ia...> - 2004-09-18 20:03:50
|
Ouch.
Don't do that.
There is the vector template class in the stl.
Do not write a method that reallocates all strings every time.
First line - allocate one string.
Second line - allocate two strings.
Third line - allocate three strings.
...
By doing this, you manage to transform a linear operation - proportional
to number of lines in the file - to become O(n^2).
If you open a 100,000 line file, you would perform 100,000^2 / 2 or
5,000,000,000 string assigns.
Never add complexity when it isn't needed.
std::vector<std::string> strings;
and then
strings.push_back(line);
or
strings.reserve(10);
strings[n++] = line;
is a lot nicer code, and tremendously much more efficient.
/Per W
On Sat, 18 Sep 2004, hielke_prins wrote:
> >> How do I refer to each line of my *.txt file???
>
> /*
> If you don't have any clue how to read a simple textfile, the first
> thing you
> proably have to do is buying a good book on C(++). But here ya go.
>
> I usually read small plaintext files in a vector using a simple
> wrapperclass.
> Something like this (if you meant to write it in C++ at least),
> didn't test it:
> */
>
> Class Lines
> {
> string *d_line;
> unsigned d_nLines;
>
> public:
> Lines(istream streamIn);
> /*
> (of course you need some simple memberfunctions
> returning linecount and lines on a given index too)
> */
> }
>
> Lines::Lines(istream streamIn)
> :
> d_nLines(0)
> {
> string inputLine,
> *tempLine;
>
> while(getline(streamIn, inputLine))
> {
> d_nLines++;
> tempLine = new string[d_nLines];
> for(unsigned i = 0; i < d_nLines; i++)
> {
> tempLine[i] = d_line[i];
> }
> delete d_line;
> d_line = tempLine;
> }
> }
>
> Regards,
> Hielke
|
|
From: hielke_prins <hie...@he...> - 2004-09-18 17:57:18
|
>> How do I refer to each line of my *.txt file???
=20
/*
If you don't have any clue how to read a simple textfile, the first=20
thing you
proably have to do is buying a good book on C(++). But here ya go.
=20
I usually read small plaintext files in a vector using a simple=20
wrapperclass.
Something like this (if you meant to write it in C++ at least),=20
didn't test it:
*/
=20
Class Lines
{
string *d_line;
unsigned d_nLines;
=20
public:
Lines(istream streamIn);
/*
(of course you need some simple memberfunctions
returning linecount and lines on a given index too)
*/
}
=20
Lines::Lines(istream streamIn)
:
d_nLines(0)
{
string inputLine,
*tempLine;
=20
while(getline(streamIn, inputLine))
{
d_nLines++;
tempLine =3D new string[d_nLines];
for(unsigned i =3D 0; i < d_nLines; i++)
{
tempLine[i] =3D d_line[i];
}
delete d_line;
d_line =3D tempLine; =20
}
}
=20
Regards,
Hielke
|
|
From: Daniel K. O. <dan...@ya...> - 2004-09-18 03:55:26
|
Claudio Martn Veas wrote: >Hi, I was looking for information about C/C++ >graphical interfaces programming for linux, where can >I get this kind of information? > You want GUI toolkits. Go to http://www.atai.org/guitool/ Then choose the one you want. Some come with big frameworks, like wxWidget, others come just with the minimum needed, like FLTK. Go to the websites and see examples of each library, then chose the one you feel more confortable. Daniel K. O. |
|
From: Claudio M. V. <cm...@ya...> - 2004-09-18 03:18:31
|
Hi, I was looking for information about C/C++ graphical interfaces programming for linux, where can I get this kind of information? you know to make windows and stuffs? Please excuse my english is not very good because im from Argentina and its been a while since the last time I used it. If theres anything else you need to know to help me just ask. Thanks on advance Claudio Veas ___________________________________________________________ 100mb gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo http://correo.yahoo.com.ar |
|
From: Per W. <pw...@ia...> - 2004-09-17 11:02:43
|
You don't want the old version 4. Uninstall both the old working and the new broken, and then install again a new version. It may be called "beta" but that is just a formality - someday they will decide to call it version 5. I don't think any real Dev-C++ users are running with version 4. The functional difference is just too large! /Per W On Fri, 17 Sep 2004, Eric wrote: > I seem to have two versions of DEV C++ > > one is called Bloodshed DEV C++, version 4.9.8.0 is a lot of rubbish, > keeps saying "source file not compiled" when I try and run it. > > > The other version I have is just DEV C++, version 4 and it just runs OK > > > > > Can anybody expand on my report. > > >From Eric > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.766 / Virus Database: 513 - Release Date: 17-Sep-04 > > > > ------------------------------------------------------- > 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 > |
|
From: Eric <eri...@cl...> - 2004-09-17 09:36:23
|
I seem to have two versions of DEV C++ one is called Bloodshed DEV C++, version 4.9.8.0 is a lot of rubbish, keeps saying "source file not compiled" when I try and run it. The other version I have is just DEV C++, version 4 and it just runs OK Can anybody expand on my report. From Eric --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.766 / Virus Database: 513 - Release Date: 17-Sep-04 |
|
From: Alexsandro M. <ale...@ho...> - 2004-09-16 20:04:44
|
Please, I've just made a script to work with sentences, but I could not realize how to work with each word in a *.txt file. Ex.: I've got teste.txt with the following words: cabeça, abóbora, jiló, menino. I want to tokenize these words with my script and separate theirs syllables. How do I refer to each line of my *.txt file??? Thanks in advance!!! _________________________________________________________________ MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com |
|
From: Jingles P. <jin...@ya...> - 2004-09-16 16:00:39
|
Hello, Now, awhile ago I started having problems with Updating Dev-Cpp. When ever I updated it I couldn't do it, It wouldn't connect to the Server and when It did there was no difference in the Version Number, nor a difference in anything with it. Could somebody please tell whats going on?! Or if its just something normal. __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail |
|
From: Per W. <pw...@ia...> - 2004-09-16 15:11:01
|
Scope isn't a problem. The compiler knows the scope the function was declared in and can declare variables and references based on that. However, pointer indirection is a problem. Virtual functions will require that the compiler is really sure about the type of the class for them to be inlined. What is inlined varies tremendously between different compilers and compiler versions. Some compilers can't handle specific language constructs when inlining. Some compilers can handle anything, but instead uses the expansion size to decide if the function should be inlined or not. /Per W On Thu, 16 Sep 2004, [ISO-8859-2] OROSZI Bal=E1zs wrote: > Hi! > > I have questions regarding inline functions. > What can be inlined? What makes a function un-inlineable? > And what kind of pre-processing does a compiler do to the body of an inli= ne function (like > removing the return statement, scopes, etc.)? > > For example: what happens if an inline function of a class calls another = class member, > like this will it be inlined? > > I'm just curious, because there can be things, which are valid inside the= class, but > because of inlining, the body gets "outside" of the class scope, which ma= kes a lot of > things different. > > Any thoughts? > > -- > Greetings, > Bal=E1zs > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: thawte's Crypto Challenge Vl > Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam > Camcorder. More prizes in the weekly Lunch Hour Challenge. > Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m > _______________________________________________ > 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: <or...@vp...> - 2004-09-15 22:44:34
|
Hi! I have questions regarding inline functions. What can be inlined? What makes a function un-inlineable? And what kind of pre-processing does a compiler do to the body of an inli= ne function (like=20 removing the return statement, scopes, etc.)? For example: what happens if an inline function of a class calls another = class member,=20 like this will it be inlined? I'm just curious, because there can be things, which are valid inside the= class, but=20 because of inlining, the body gets "outside" of the class scope, which ma= kes a lot of=20 things different. Any thoughts? -- Greetings, Bal=E1zs |
|
From: Abhijeet S <abh...@ms...> - 2004-09-15 14:09:28
|
Compiler: Default compiler Executing gcc.exe... gcc.exe "F:\Downloaded\echoserv\echoserv.c" -o "F:\Downloaded\echoserv\echoserv.exe" -ansi -traditional-cpp -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" C:\Dev-Cpp\Bin\..\lib\gcc-lib\mingw32\3.2\tradcpp0.exe: invalid option `-std=c89' Execution terminated Could someone tell me what kind of an error is this ? _________________________________________________________________ Win a trip to Singapore! Experience the magic! http://eu.xmts.net/80450 Click here for details! |
|
From: Michal M. <mi...@mo...> - 2004-09-15 10:32:20
|
Nolan Clayton wrote: > 1.Is there a place where devc++ users post their templates? If so, where? > I have a couple of wxwidgets templates that could be useful. You can pack them into the templates-only devpak and put it on devpaks.org. > 2.Sorry for asking this one. I know devc++ is gpl'ed but does the use > of devc++ require you to open your source code? Or does it depend on > the libraries and or compiler you use? And are there any free compilers > that allow you sell your apps without opening the source. Have you tried to read the GPL licence? http://www.gnu.org/licenses/gpl.html It clearly states: "Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does." So, unless you create modified version of Dev-C++, your program is not restricted to use GPL. It of course depends on everything you use to create your program, the MinGW licence is described here: http://mingw.org/mingwfaq.shtml#faq-license -- Regards, Michal |
|
From: Eric <eri...@cl...> - 2004-09-15 09:54:27
|
I must finish it and let you know ----- Original Message ----- =46rom: "Noorez Kassam" <dar...@ho...> To: <dev...@li...> Sent: Monday, September 13, 2004 4:21 AM Subject: [Dev-C++] passwords I asked a while ago about hiding passwords and someone suggested usin= g standard charater in by cin and then backspace on the character to hi= de it but that seems awakward becuase then u would have to use the enter ke= y for each character and that would bring it down to the next line. Is ther= e a way to use in so that u don't need the enter key? _________________________________________________________________ Take advantage of powerful junk e-mail filters built on patented Microsoft=AE SmartScreen Technology. http://join.msn.com/?pgmarket=3Den-ca&page=3Dbyoa/prem&xAPID=3D1994&D= I=3D1034&SU =3Dhttp://hotmail.com/enca&HL=3DMarket_MSNIS_Taglines Start enjoying all the benefits of MSN=AE Premium right now and get= the first two months FREE*. ------------------------------------------------------- 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. 13. 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 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.762 / Virus Database: 510 - Release Date: 13-Sep-04 |
|
From: Per W. <pw...@ia...> - 2004-09-15 08:26:52
|
You should ave posted the source of the broken function with a stub program that displays the error. /Per W On Tue, 14 Sep 2004, Siva Chandra wrote: > > Hello all, > > I have a strange problem with printf statements. I do > a lot of coding for image-processing functions in C++. > Though C++, I prefer using the cstdio for console I/O. > As indicators for de-bugging, I put in a lot of > printf statements everywhere in my code. Now, my > problem is this: The result of my function depends on > inclusion of a printf statement!! If I comment out > that statement, the output of my function is different > as compared to the one which is got by not commenting > out that statement!!!! > > Has anyone had such a problem before and figured out > what could be the reason for such a problem? > > TIA, > Siva Chandra > > > > > > __________________________________ > Do you Yahoo!? > New and Improved Yahoo! Mail - 100MB free storage! > http://promotions.yahoo.com/new_mail > > > ------------------------------------------------------- > This SF.Net email is sponsored by: thawte's Crypto Challenge Vl > Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam > Camcorder. More prizes in the weekly Lunch Hour Challenge. > Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m > _______________________________________________ > 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 > |