dev-cpp-users Mailing List for Dev-C++ (Page 378)
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: <or...@vp...> - 2003-05-27 19:34:13
|
Christian Schmidt wrote:
> Given x = 123 and ptr_int = &x after that *ptr_int = 456 has been executed.
> What is the value of x?
If I implemented this, this is how I would do it:
#include <stdio.h>
main()
{
int x, *ptr_int;
x = 123; /* Given x = 123 */
ptr_int = &x; /* and ptr_int =&x */
*ptr_int = 456; /* after that *ptr_int = 456 has been executed */
printf("%d",x); /* What is the value of x? */
/* The answer is: 123 */
}
> This is how I see it:
>
> main ( )
> {
> int x, *ptr_int;
>
> *ptr_int = 456; /*This pointer is a null pointer at this moment right? */
>
> x =123;
> ptr_int = &x; /* As x is just set to 123 and the statement *ptr_int = 456;
> was executed before I would think *ptr_int would be 123 */
>
> }
This is a *wrong* implementation of the example. The book does not state
this. It states what I wrote above.
And the reason why it does not segfault is only luck. *ptr_int is not
NULL at the beginning! Variables are NOT initialised, it is up to you to
do that. *ptr_int just points to somewhere, and you only had luck, that
using it didn't cause any trouble. Try setting ptr_int to NULL before
you dereference it (*ptr_int). It will surely segfault then.
You should always keep it in mind, that variables are NEVER initialised
to a default value! You must have to do that!
> But the books says the value of *ptr_int at the end is 456. How come??
The book is correct.
--
Greetings,
Balázs
|
|
From: Christian S. <sm...@xs...> - 2003-05-27 19:14:19
|
Thanks for your answer Avik.
I'm now working another question from the book. However I seem to have a
different result than theory would dictate.
Look at and perhaps run the commented source code:
#include <stdio.h>
main ( )
{
double flt_num, *flt_ptr;
flt_num = 123,45;
/* This bit shows (prints) the value of flt_num and then
it's adress in memory */
printf ("flt_num = %f.\n",flt_num);
printf ("The adress of flt_num is %p.\n",&flt_num);
/* Assigning the pointer to the variable flt_num */
flt_ptr = &flt_num;
/* Setting to value of flt_num via a pointer variable to the
new value */
*flt_ptr = 543,21;
/* Here comes my problem. If I would ask for the value of the pointer.
Its called flt_ptr btw. In theory it should show the memory address of
the variable flt_num. But in MSV++ 6 it shows 0.000000 and in DevCPP the
value of *flt_ptr. Is this a feature or a bug? */
/* Now I'm priting the value of the pointer to screen */
printf ("flt_ptr = %f.\n",flt_ptr); /* This should be == to &flt_num but
it isn't!!*/
printf ("The adress of flt_ptr is %p.\n",&flt_ptr);
printf ("*flt_ptr = %f.\n", *flt_ptr);
return 0;
}
-----Original Message-----
From: Avik Ghose [mailto:a_g...@ya...]
Sent: dinsdag 27 mei 2003 20:52
To: Christian Schmidt
Subject: Re: [Dev-C++] Question about pointers (beginner)
Hi Christian,
the very statement
*ptr_int = 456;
is malicious. Cause the pointer right now is neither null(except if your
compiler is kind enough to do so) nor it points to any valid address
assigned to your programs run-time memory or the heap.
As to what your book says, that is completely impossible to happen. If the
program at all runs without any run-time error, the value of *ptr_int will
be 123.
Christian Schmidt <sm...@xs...> wrote:
From my book:
Given x = 123 and ptr_int = &x after that *ptr_int = 456 has been
executed.
What is the value of x?
I thought it was 123 as the pointer *ptr_int is a null pointer and can't
have any value.
This is how I see it:
main ( )
{
int x, *ptr_int;
*ptr_int = 456; /*This pointer is a null pointer at this moment right?
*/
x =123;
ptr_int = &x; /* As x is just set to 123 and the statement *ptr_int =
456;
was executed before I would think *ptr_int would be 123 */
}
----------
But the books says the value of *ptr_int at the end is 456. How come??
Thanks for your time,
Christian
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational datab! ase is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
_______________________________________________
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
Thanx and Regards
Avik Ghose
Catch all the cricket action. Download Yahoo! Score tracker
|
|
From: Khalid El-K. <kha...@ho...> - 2003-05-27 19:13:59
|
Did you try that code with any compiler, the line *ptr_int = 456; should
give a segmentation fault!
given that there's isn't a code you missed from the book :-)
>From my book:
>
>Given x = 123 and ptr_int = &x after that *ptr_int = 456 has been executed.
>What is the value of x?
>
>I thought it was 123 as the pointer *ptr_int is a null pointer and can't
>have any value.
>
>This is how I see it:
>
>main ( )
>{
>int x, *ptr_int;
>
>*ptr_int = 456; /*This pointer is a null pointer at this moment right? */
>
>x =123;
>ptr_int = &x; /* As x is just set to 123 and the statement *ptr_int = 456;
>was executed before I would think *ptr_int would be 123 */
>
>}
>
>----------
>
>But the books says the value of *ptr_int at the end is 456. How come??
>
>Thanks for your time,
>
>Christian
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: ObjectStore.
>If flattening out C++ or Java code to make your application fit in a
>relational database is painful, don't do it! Check out ObjectStore.
>Now part of Progress Software. http://www.objectstore.net/sourceforge
>_______________________________________________
>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
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
|
|
From: Smurf, P. <smu...@xs...> - 2003-05-27 19:09:37
|
Ok you are correct however. But I was looking for the value of x or even
*ptr_int not ptr_int.
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of Felipe
> Lima
> Sent: dinsdag 27 mei 2003 20:51
> To: dev...@li...
> Subject: Fw: [Dev-C++] Question about pointers (beginner)
>
>
> When you say *ptr = &variable, you are assigning the memory address of the
> variable to the pointer, not the variable's real value(123).
> So the final value of ptr_int would be the memory address of the
> variable(x), which is unknown for us, only the program knows.
>
>
> -=-=-=-=-=-=-
> Felipe Lima - Software Tester/ Developer
> CPTS - Software Test Research Center
> HP Brazil - PUCRS
> ----- Original Message -----
> From: "Christian Schmidt" <sm...@xs...>
> To: <dev...@li...>
> Sent: Tuesday, May 27, 2003 3:17 PM
> Subject: [Dev-C++] Question about pointers (beginner)
>
>
> > >From my book:
> >
> > Given x = 123 and ptr_int = &x after that *ptr_int = 456 has been
> executed.
> > What is the value of x?
> >
> > I thought it was 123 as the pointer *ptr_int is a null pointer and can't
> > have any value.
> >
> > This is how I see it:
> >
> > main ( )
> > {
> > int x, *ptr_int;
> >
> > *ptr_int = 456; /*This pointer is a null pointer at this moment
> right? */
> >
> > x =123;
> > ptr_int = &x; /* As x is just set to 123 and the statement
> *ptr_int = 456;
> > was executed before I would think *ptr_int would be 123 */
> >
> > }
> >
> > ----------
> >
> > But the books says the value of *ptr_int at the end is 456. How come??
> >
> > Thanks for your time,
> >
> > Christian
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: ObjectStore.
> > If flattening out C++ or Java code to make your application fit in a
> > relational database is painful, don't do it! Check out ObjectStore.
> > Now part of Progress Software. http://www.objectstore.net/sourceforge
> > _______________________________________________
> > 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
> >
> >
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: ObjectStore.
> If flattening out C++ or Java code to make your application fit in a
> relational database is painful, don't do it! Check out ObjectStore.
> Now part of Progress Software. http://www.objectstore.net/sourceforge
> _______________________________________________
> 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
>
|
|
From: Felipe L. <li...@cp...> - 2003-05-27 18:51:17
|
When you say *ptr = &variable, you are assigning the memory address of the
variable to the pointer, not the variable's real value(123).
So the final value of ptr_int would be the memory address of the
variable(x), which is unknown for us, only the program knows.
-=-=-=-=-=-=-
Felipe Lima - Software Tester/ Developer
CPTS - Software Test Research Center
HP Brazil - PUCRS
----- Original Message -----
From: "Christian Schmidt" <sm...@xs...>
To: <dev...@li...>
Sent: Tuesday, May 27, 2003 3:17 PM
Subject: [Dev-C++] Question about pointers (beginner)
> >From my book:
>
> Given x = 123 and ptr_int = &x after that *ptr_int = 456 has been
executed.
> What is the value of x?
>
> I thought it was 123 as the pointer *ptr_int is a null pointer and can't
> have any value.
>
> This is how I see it:
>
> main ( )
> {
> int x, *ptr_int;
>
> *ptr_int = 456; /*This pointer is a null pointer at this moment right? */
>
> x =123;
> ptr_int = &x; /* As x is just set to 123 and the statement *ptr_int = 456;
> was executed before I would think *ptr_int would be 123 */
>
> }
>
> ----------
>
> But the books says the value of *ptr_int at the end is 456. How come??
>
> Thanks for your time,
>
> Christian
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: ObjectStore.
> If flattening out C++ or Java code to make your application fit in a
> relational database is painful, don't do it! Check out ObjectStore.
> Now part of Progress Software. http://www.objectstore.net/sourceforge
> _______________________________________________
> 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
>
>
|
|
From: Christian S. <sm...@xs...> - 2003-05-27 18:27:23
|
I just executed this code:
#include <stdio.h>
main ( )
{
int x, *ptr_int;
*ptr_int = 456;
printf ("The value of ptr_int is %p\n",ptr_int);
printf ("The value of *ptr_int is %d\n",*ptr_int);
x = 123;
ptr_int = &x;
printf ("The value of ptr_int is %p\n",ptr_int);
printf ("The value of *ptr_int is %d\n",*ptr_int);
printf ("The value of x is %d\n",x);
printf ("The value of &x is %p\n",&x);
}
And it gives me as expected 123 for x. However I would expect an error or
something like that for the line: *ptr_int = 456;
as *ptr_int is not linked to any memory address at that time. Anyway maybe
it was a error in the book when they stated that the end result of x should
be 456 instead of 123 as I expected.
|
|
From: <or...@vp...> - 2003-05-27 18:23:22
|
matt wrote: > Executing make... > make.exe -f "C:\Dev-Cpp\Makefile.win" all > gcc.exe votest.o -o "votest.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/lib" > -s -mwindows lib/libm.a libtestx.a > votest.o(.text+0x3a):votest.c: undefined reference to `mysub' I have no idea at all. Are you sure the library is correctly compiled? Is the library stripped? It tends to make the library unusable if it is stripped. Apart from that, this should work. If you are an experienced UNIX programmer, then it will be no problem for you to write the program with a text editor, and compile it by hand, with the same options that Dev-C++ uses. Then you can tune it, as long as you get the differences, that makes the error. Your example compiled perfectly for me. -- Greetings, Balázs |
|
From: Christian S. <sm...@xs...> - 2003-05-27 18:17:08
|
From my book:
Given x = 123 and ptr_int = &x after that *ptr_int = 456 has been executed.
What is the value of x?
I thought it was 123 as the pointer *ptr_int is a null pointer and can't
have any value.
This is how I see it:
main ( )
{
int x, *ptr_int;
*ptr_int = 456; /*This pointer is a null pointer at this moment right? */
x =123;
ptr_int = &x; /* As x is just set to 123 and the statement *ptr_int = 456;
was executed before I would think *ptr_int would be 123 */
}
----------
But the books says the value of *ptr_int at the end is 456. How come??
Thanks for your time,
Christian
|
|
From: matt <mat...@pa...> - 2003-05-27 17:09:08
|
I am newbie to devcpp but an experienced UNIX programmer. I have the
simplest example possible that I cannot
get to link. I keep getting undefined reference error even though the
library is found by the linker (since
when I change the name it complains):
I am using the latest beta version , but the help calls the version 4.9.8.0
Here is the error:
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe votest.o -o "votest.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/lib"
-s -mwindows lib/libm.a libtestx.a
votest.o(.text+0x3a):votest.c: undefined reference to `mysub'
Here are the simple sources :
votest.c:
#include "testx.h"
int main(int argc, char *argv[])
{
int x;
x = 1;
x = mysub( x );
printf("x=%d\n", x);
system("PAUSE"); return 0;
}
Here is the library source:
textx.c:
#include <stdio.h>
int mysub( int x )
{
x = x + 1;
return ( x );
}
|
|
From: <ma...@en...> - 2003-05-27 16:43:47
|
Hello, All
A simple case: I have main.cpp + myclass.h with class "myclass" fully declared
& defined in it. But in Makefile.win i see:
main.o: main.cpp
$(CPP) -c main.cpp -o main.o $(CXXFLAGS)
So, when I modify class member in .h file, project doesn't recompile, it only
links.
Is there any way to add *.h dependency to *.cpp in makefile?
--
Regards!
Maxim
|
|
From: Data <lie...@ya...> - 2003-05-27 12:51:04
|
Pardon me if I'm way off base (seeing as I am a newbie myself), but I think what happens is that your loop waits for a keypress (getchar()), checks to see if c=='x', then breaks regardless -- your if statement ends in a semicolon, thus you are doing nothing if the if statement is true -- (I think) you need to drop that semicolon.
Hope that helps!
Christian Schmidt <sm...@xs...> wrote:
When I run this code it exits after any key I press. What am I doing wrong?
#include
main ( )
{
int c;
printf ("Enter a character:\n(Enter x to exit\n");
while (1)
{
c = getchar ( );
if (c == 'x');
break;
}
printf ("Exiting the loop now!\n");
return 0;
}
Thanks
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
_______________________________________________
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
---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo. |
|
From: Daniel G. <sp...@ho...> - 2003-05-26 10:33:44
|
I was wondering about a problem a friend has... when they choose ShutDown the machine shuts down but then restarts immediately after. I ran a check using some windows software (this in windows 98 btw) and it said setupx.dll was corrupted, and so I restored from the backup in the CABS folder, but I don't know if this has solved the problem. If it has not, what could the cause be? It's not a new machine, she's been using it for about 2-3 years. _________________________________________________________________ Express yourself with cool emoticons - download MSN Messenger today! http://www.msn.co.uk/messenger |
|
From: Luigi S. <gi...@li...> - 2003-05-26 10:13:00
|
> > From: Keats [mailto:ke...@ih...] > > Sent: maandag 26 mei 2003 2:39 > > Hi, > > [...] > > to me there is another error in the code, apart from the one Papa > > Smurf found. You declared 'c' as a int, shouldn't this be a > > declared as a char or string or are these operations > > allowed in C/C++? > > When reading a stream on a one character basis, it could happen to find some input which does not fit within a "char" frame; the end of file marker (EOF) obtained as CTRL+z (or CTRL+d on *nix), which is an "int", is probably the best known example. -- >> gisan >> |
|
From: Luigi S. <gi...@li...> - 2003-05-26 10:12:57
|
On Sun, May 25, 2003 at 04:45:08PM -0400, Jeffrey Hall wrote:
> [...]
> In short, I can't scroll back in the DOS window to mark (select) the
> beginning of a file that's more than circa 24 lines long and then save the
> file.
Hi Jeff,
As your program prints its output to the stdout stream, you could redirect
this latter stream to a file, so that output will be saved and available to
be examined later.
To redirect stdout, you should run your program from the Dos command
line, using the following syntax (assuming "fib.exe" is the name of the
program and "fib.out" the name of the file where you wish to store output)
fib > fib.out
Also, if you want to have the output of two runs stored in the same file,
you may "redirect and append", that is, after the above command use the
following one:
fib >> fib.out
To tell apart output of the two runs, I suggest printing something at
the end of the run, that could be as simple as a couple of '\n' characters.
Finally, in case your program gets input from the stdin stream, you may
save some typing by creating a file with your input and feeding it to the
program by the command (assuming "fib.inp" is the file storing input)
fib < fib.inp
Of course stdin and stdout may be redirected at the same time.
> [...]
> getch();
> return 0;
> }
>
NOTE: the above "getch()" is not required when the program is to be
used from a Dos window (as I think it should be always done when the
program is a console application). IMHO, using such instruction is
bad practice, in fact, a potential user could run the program from the
console and use redirection, not getting the prompt back (because of
the program waiting for the extra input character needed by the non-portable
"getch" instruction) he could think that execution got trapped in some
infinite loop (especially if the program deals with math ;-) and then
just kill the application by closing the Dos window.
--
>> gisan >>
|
|
From: Roberto R. <rob...@ar...> - 2003-05-26 03:04:54
|
Hi all, Please, I need to know, there are some solution about the (almost for me) problem with devcpp 4.9.8 and gcc 3.xx and lost libraries paths (lot of messages here about). Im using the devcpp core 4.9.80 with gcc 2.9xx with ' c ' and xp windows without problems, but when try with gcc 3.xx appears again. It is just wrong with xp environment only or there are more mistakes I can't discover ? Any ideas ? Thanks in advance Roberto |
|
From: Keats <ke...@ih...> - 2003-05-26 01:13:20
|
Ahhh kewl, from what I learnt with java at uni you didn't need to worry about ascii when reading in chars from the keyboard. However it was used to validate if a char was between certain values, ie. a-z or A-Z, but even then all you needed to know about was in which order they went which isn't hard at all. From what I can see from your code, C/C++ is fairly similar in that respect or is it more important with more difficult programs? Matt |
|
From: Christian S. <sm...@xs...> - 2003-05-26 00:51:03
|
Hi,
I'm a beginner too :)
As far as I know, in this context ( the code I forwarded) it's needed as the
stdio functions getc ( ) and getchar ( ) return the interger value of the
character. However its easy to convert them back to an ascii character like
when using the function printf (). Ooh and I havn't reached the bit on
strings yet so its possible you are right but the author just wants to keep
it simple for now and use intergers. Everything is a number on a computer
(as the author once said).
example
#include <stdio.h>
main ( )
{
int c; /* Declare interger */
c = getchar ( ); /* reads your keyboard for pressed keys and return the
ascii value */
printf ("You pressed %c which ascii is %d.\n",c,c);
return 0;
}
BTW: You forgot to CC the list and I and Papa Smurf are the same people :).
Its just that my reply is setup that way.
> -----Original Message-----
> From: Keats [mailto:ke...@ih...]
> Sent: maandag 26 mei 2003 2:39
> To: Christian Schmidt
> Subject: Re: [Dev-C++] Why is this code not doing what it should do?
> (simple example code from book)
>
>
> Hi,
>
> I'm a java programmer who is just about to learn C/C++ (just finding the
> time is the hard part :( ) but to me there is another error in the code,
> apart from the one Papa Smurf found. You declared 'c' as a int,
> shouldn't this be a declared as a char or string or are these operations
> allowed in C/C++?
>
> Matt
>
>
>
|
|
From: Smurf, P. <smu...@xs...> - 2003-05-25 23:55:41
|
I found the error
if (c == 'x');
break;
should be
if (c=='x') <--- no semi colon here!!
break;
Bye
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of Christian
> Schmidt
> Sent: maandag 26 mei 2003 1:36
> To: dev...@li...
> Subject: [Dev-C++] Why is this code not doing what it should do? (simple
> example code from book)
>
>
> When I run this code it exits after any key I press. What am I
> doing wrong?
>
> #include <stdio.h>
>
> main ( )
> {
> int c;
>
> printf ("Enter a character:\n(Enter x to exit\n");
> while (1)
> {
> c = getchar ( );
> if (c == 'x');
> break;
> }
> printf ("Exiting the loop now!\n");
> return 0;
> }
>
> Thanks
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: ObjectStore.
> If flattening out C++ or Java code to make your application fit in a
> relational database is painful, don't do it! Check out ObjectStore.
> Now part of Progress Software. http://www.objectstore.net/sourceforge
> _______________________________________________
> 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
>
|
|
From: Christian S. <sm...@xs...> - 2003-05-25 23:42:25
|
When I run this code it exits after any key I press. What am I doing wrong?
#include <stdio.h>
main ( )
{
int c;
printf ("Enter a character:\n(Enter x to exit\n");
while (1)
{
c = getchar ( );
if (c == 'x');
break;
}
printf ("Exiting the loop now!\n");
return 0;
}
Thanks
|
|
From: Jeffrey H. <jj...@er...> - 2003-05-25 20:44:33
|
Jeff Hall
----- Original Message -----
From: "Jeffrey Hall" <jj...@er...>
To: <dev...@li...>
Sent: Sunday, May 25, 2003 4:42 PM
Subject: saving output
Sorry..........
> Maybe you could help here.I'm running Dev-C++ 4.9.7.0
>
> In the enclosed program I can save only the out put that appears in the
DOS
> window.
> In short, I can't scroll back in the DOS window to mark (select) the
> beginning of a file that's more than circa 24 lines long and then save the
> file.
>
> There must be a way either to write the file to a Windows application (
via
> Printf?)
> or at least save the whole output file...................
> Jeff Hall
>
#define FIBC .0618034
#include <stdio.h>
#include <conio.h>
#pragma hdrstop
#pragma argsused
//--------------------------------------------------------------------------
-
#pragma argsused
float innumn, innumr;
float result,resulta,resultb,resultc;
float t;
float s;
main()
{
//1st bracket
printf( "Type a 1st number %f: ", innumn);
scanf("%f",&innumn);
printf( "Type a 2nd number larger than the 1st %f: ", innumr);
scanf("%f",&innumr);
{
//2nd bracket for preloop declarations
t = 45.0;
s = 0.;
for (s=1; (s <= (t - 1)); s++)
{
//3rd bracket for loop body
resulta = innumr-innumn;
//printf( "\n 2nd number - 1st number is %f: ", resulta);
resultb = resulta*FIBC;
//printf( "\n (2nd number - 1st number)* fibfact is %f: ", resultb);
resultc = resulta+resultb;
//printf( "\n (the diff between 2nd & 1st nums + fibfac of same is %f:
", resultc);
result = (innumr+resultc);
innumr = result - resulta;
printf ("\n Next Fibcurve coefficient of (innumr-innumn)*FIBC is £%f: ",
result);
}
//3rd bracket for loop body close
}
//2nd bracket for preloop declarations close
getch();
return 0;
}
//1st bracket close
|
|
From: Jeffrey H. <jj...@er...> - 2003-05-25 20:41:57
|
Maybe you could help here.I'm running Dev-C++ 4.9.7.0 In the enclosed program I can save only the out put that appears in the DOS window. In short, I can't scroll back in the DOS window to mark (select) the beginning of a file that's more than circa 24 lines long and then save the file. There must be a way either to write the file to a Windows application ( via Printf?) or at least save the whole output file................... Jeff Hall |
|
From: Charles <cha...@at...> - 2003-05-25 17:37:51
|
Russell > “Please run the project at least once so that profiling info is generated...” > I've run my prject numerous times, and set all the options which should allow this to work. In addition, I've searched Google, and asked many people for help and have received nothing. I had a similar problem with profile analysis. There has been some discussion on the Bloodshed Software Forum on Sourceforge. (http://sourceforge.net/forum/forum.php?forum_id=48211) The current version of Dev-C++ is buggy. For now there are workarounds. Take a look at http://www14.brinkster.com/aditsu/dev-cpp-faq.html. There you will find, "If you need code profiling, add -pg to project options - parameters - linker." Also, profile analysis must be enabled in BOTH the Compiler Options and the Project Options. Chuck |
|
From: Matthews <dem...@uw...> - 2003-05-25 15:35:26
|
Maybe you should try not sending the same message three times within nine days. At 04:48 PM 23/05/2003 +0200, Michael Stather wrote: >Hi, > >I recently managed how to get debugging to work in Dev-C++, but I noticed 2 >problems: > >1. I have to manually enable "create debug info" in the linker settings for >debugging. Perhaps it should be enabled automatically (or by asking the >user) when the "debug"-button is pressed the first time. > >2. If I set breakpoints, only the ones in my "int main"- >function are reagrded and processed, but if I set them for example in the >constructor of some of my classes the program never stops there. Also >Dev-C++ says "the .exe file is older than the source-files, do you want to >recompile it?", even if I make a full recompile and then change nothing. > >If somebody has an idea how to fix #2, it would be very cool, since I need >debugging very much (as a beginner :) ) > > > >------------------------------------------------------- >This SF.net email is sponsored by: ObjectStore. >If flattening out C++ or Java code to make your application fit in a >relational database is painful, don't do it! Check out ObjectStore. >Now part of Progress Software. http://www.objectstore.net/sourceforge >_______________________________________________ >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 > |
|
From: Per W. <pw...@ia...> - 2003-05-25 11:06:36
|
You mention a syntax error in line 2 of stdio.h. Then you display a couple of lines a long way later - line 221 and line 375. What do you mean? Anyway, the most common reason to get a compiler error at a very early line number of a a include file is that you have an error in a previous include file - such as a missing seimicolon at the end of a declaration. When the compiler then finds the first statement of the next include file, it will detect the missing semicolon and complain. /Per W On Sun, 25 May 2003, Daniel Glenfield wrote: > Have you opened the file and had a look? > You may want to download the latest version from the web - try a search on > google perhaps? > > > >From: "Tassos Tzavellas" <atz...@at...> > >Reply-To: "Tassos Tzavellas" <el...@ma...> > >To: <dev...@li...> > >Subject: [Dev-C++] (no subject) > >Date: Sun, 25 May 2003 12:06:47 +0300 > > > >Whenever I include stdio.h(#include <stdio.h>) I get a compiler message > >that there is an syntax error in 2 line of stdio.h. > > > >line 221: "extern inline int vsnprintf (char* s, size_t n, const char* > >format," > >line 375: "extern inline int vsnwprintf (wchar_t* s, size_t n, const > >wchar_t* format," > >My programs still run even though I never include that library but one day > >they might not.What can I do to fix that problem? > > _________________________________________________________________ > Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ObjectStore. > If flattening out C++ or Java code to make your application fit in a > relational database is painful, don't do it! Check out ObjectStore. > Now part of Progress Software. http://www.objectstore.net/sourceforge > _______________________________________________ > 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 > |
|
From: Daniel G. <sp...@ho...> - 2003-05-25 09:49:34
|
Have you opened the file and had a look? You may want to download the latest version from the web - try a search on google perhaps? >From: "Tassos Tzavellas" <atz...@at...> >Reply-To: "Tassos Tzavellas" <el...@ma...> >To: <dev...@li...> >Subject: [Dev-C++] (no subject) >Date: Sun, 25 May 2003 12:06:47 +0300 > >Whenever I include stdio.h(#include <stdio.h>) I get a compiler message >that there is an syntax error in 2 line of stdio.h. > >line 221: "extern inline int vsnprintf (char* s, size_t n, const char* >format," >line 375: "extern inline int vsnwprintf (wchar_t* s, size_t n, const >wchar_t* format," >My programs still run even though I never include that library but one day >they might not.What can I do to fix that problem? _________________________________________________________________ Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile |