dev-cpp-users Mailing List for Dev-C++ (Page 490)
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: Carlos d. M. <cg...@wo...> - 2002-11-10 11:10:43
|
You must compile it as a console application and pass -lmingw32 -lSDLmain= -lSDL to the linker options Matthews escribi=F3: > I have a strange error when attempting to use the SDL libraries > (www.libsdl.org) I've configured everything right, downloaded the comp= lete > package with all the libraries, include files, etc. yet when I attempt = to > compile the sample SDL program (with -lsdl) I get the error [Linker err= or] > Unknown reference to `WinMain@16' What's wrong? > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > 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: Zodiaq <zo...@ac...> - 2002-11-10 08:40:31
|
Hello Per and all Dev-C++ users, Sunday, November 10, 2002, 1:19:36 AM, Per wrote as follows: [some quite nice code] Yeah this looks like a good idea... I'll have to correct few bugs (like not checking if we have more than a week between two dates - in that case code will work bad...) or first I'll try to get job done by checking in wkich week of the year this days are... maybe will get less comparisons... PW> /Per W -- regards, Zodiaq |
|
From: Abhijit S. <mu...@gm...> - 2002-11-10 08:35:06
|
Greets, Santiago.
> Hi Does anyone know if it's possible installing GNU G++ 3.2 in windows xp?
I run MingW with:
gcc version 3.2 (mingw special 20020817-1)
I had Dev with GCC 2.95 and just installed MingW over it and it works fine.
___________________________________________________________
Abhijit Shylanath
E-mail: mu...@gm... || ibr...@bi...
Web-site: http://mudeth.tripod.com/
|
|
From: Abhijit S. <mu...@gm...> - 2002-11-10 08:34:56
|
Greets, Chris.
> I have been reading a book called "C++ From Scratch"
> and there is a program that you make as you read the
> book. The book has Dev C++ version 3, but I updated
> to the beta. What I have started is attached so that
> you can test it. I'm a newbie, so it is kinda
> difficult to work with.
I just glanced through the code, and noticed three mistakes:
you say
std::count
It is, actually,
std::cout
As in C out.
And
std::sin
is, actually,
std::cin
. When you're typing in the examples make sure that you type in the keywords
and variable names properly.
Also, you say
Char whatever;
It should be
char whatever;
C is case-sensitive, so be very careful.
One more thing. Instead of saying std::cout or std::cin everywhere, you
could just say
using namespace std;
at the beginning of (and inside) main, and just use cout or cin later on.
___________________________________________________________
Abhijit Shylanath
E-mail: mu...@gm... || ibr...@bi...
Web-site: http://mudeth.tripod.com/
|
|
From: Abhijit S. <mu...@gm...> - 2002-11-10 08:34:48
|
Greets, Phil. > This window is a "read only" area for the user, i.e. I > do not want the user to be able to enter any text in > it. Use the ES_READONLY style flag. > The displayed datas (alphanums) are coming from an > other process , char by char. > I want to display the datas as soon as they are coming > in, w/o loosing the ones yet displayed (auto-scroll). > The input volume of datas can be of any length (more > than one visible window) and the user should be able > to save the whole datas into a file on disk at any > moment (but then the data input is stopped). > Is there any other way (more efficient) than using > SetWindowText every time I have an input (which occurs > 2-3 times per second) ? This is the only way I know. One more thing you can do is save the input data into a temporary buffer and update it only when the buffer is full, after which you can reset the buffer. This reduces the frequency and number of calls to SetWindowText(). When you want the text later, call GetWindowText(). > Alternate way I tried w/o success : writing the datas > on the fly in a file opened as "SHARE" by my soft. > Opening it agn for reading (to do a global > SetWindowText) does not help and the reading is done > only when the writing channel is closed. What's the > hint to really have a shared access to the file within > the same process ? There's no point opening the file for sharing in the same process. You can as well create a RAM buffer, which will be faster and more efficient. If you still want to use a file, you can try calling FlushFileBuffers(). ___________________________________________________________ Abhijit Shylanath E-mail: mu...@gm... || ibr...@bi... Web-site: http://mudeth.tripod.com/ |
|
From: Eric R. <e.r...@pa...> - 2002-11-10 03:26:06
|
#include <iostream>
int main()
{
std::count << "Decryptix. 9C)Copyright 1999 Liberty ";
std::count << "Associates, Inc. Version 0.2\n " << std::end1;
std::count << "There are two ways to play Decryptix: ";
std::count << " either you can guess a pattern I create, ";
std::count << "or I can guess your pattern.\n\n";
std::count << "If you are guessing, I will think or a\n ";
std::count << "pattern of letters (e.g., abcde).\n\n";
std::count << "On each turn, you guess the pattern and\n";
std::count << " I will tell you how many letters you \n";
std::count << "got right, and how many of the correct\n";
std::count << " letters were in the correct position.\n\n";
std::count << "The goal is to decode the puzzle as quickly\n";
std::count << "as possible. You control how many letters \n";
std::count << "can be used and how many positions\n";
std::count << " (e.g., 5 possible letters in 4 positions) \n";
std::count << "as well as whether or not the pattern might";
std::count << " contain duplicate letters (e.g., aabcd).\n\n";
std::count << "If I'm guessing, you think of a pattern \n";
std::count << "and score each of my answers.\nn" << std::end1;
const int minLetters = 2;
const int maxLetters = 10;
const int minPositions = 3;
const int maxPositions = 10;
int howManyLetters = 0, HowManyPositions = 0;
bool duplicatesAllowed = false;
int round = 1;
std::count << "How many letters? (";
std::count << "minLetters << "-" << maxLetters << "): ";
std::sin >> howManyLetters;
std::count << "How many positions? (";
std::count << "minPositions << maxPositions << "): ";
std::cin >> howManyPositions;
Char choice;
std::count << "Allow duplicates (y/n? ";
std::cin >> choice;
return 0;
}
From Eric
NO ATTACHMENT WAS SENT WITH THIS EMAIL,
IF THERE IS ONE, IT IS A UNDETECTED VIRUS, PLEASE LET ME KNOW..
Black text on white background HTML Emails I get, are replied with white
text on white.
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Chris Dye
Sent: 10 November 2002 15:57
To: dev...@li...
Subject: [Dev-C++] Help with Program
I have been reading a book called "C++ From Scratch"
and there is a program that you make as you read the
book. The book has Dev C++ version 3, but I updated
to the beta. What I have started is attached so that
you can test it. I'm a newbie, so it is kinda
difficult to work with.
~Thanks~
E-mail: dre...@ya... or
vip...@ea...
=====
Programming Board/Forum
This is my new programming forum, it isn't that great looking, but it is
better than nothing. Check it out, if you are good with HTML, and are
willing to work as a Mod, I can sign you up, if I can figure out how to.
Please tell friends about the forum, cause there are not that many people on
checking out the site.
__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/02
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/02
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/02
|
|
From: Chris D. <dre...@ya...> - 2002-11-10 02:56:45
|
I have been reading a book called "C++ From Scratch" and there is a program that you make as you read the book. The book has Dev C++ version 3, but I updated to the beta. What I have started is attached so that you can test it. I'm a newbie, so it is kinda difficult to work with. ~Thanks~ E-mail: dre...@ya... or vip...@ea... ===== Programming Board/Forum This is my new programming forum, it isn't that great looking, but it is better than nothing. Check it out, if you are good with HTML, and are willing to work as a Mod, I can sign you up, if I can figure out how to. Please tell friends about the forum, cause there are not that many people on checking out the site. __________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 |
|
From: Chris D. <dre...@ya...> - 2002-11-10 02:52:35
|
I have been reading a book called "C++ From Scratch" and there is a program that you make as you read the book. The book has Dev C++ version 3, but I updated to the beta. What I have started is attached so that you can test it. I'm a newbie, so it is kinda difficult to work with. ~Thanks~ E-mail: dre...@ya... or vip...@ea... __________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 |
|
From: Matthews <dem...@uw...> - 2002-11-10 01:59:56
|
I have a strange error when attempting to use the SDL libraries (www.libsdl.org) I've configured everything right, downloaded the complete package with all the libraries, include files, etc. yet when I attempt to compile the sample SDL program (with -lsdl) I get the error [Linker error] Unknown reference to `WinMain@16' What's wrong? |
|
From: Per W. <pw...@ia...> - 2002-11-10 00:20:04
|
This is a bit naive, since it doesn't take into account that a week
changes at different times depending on locale (sunday or monday being
first day of week), but I don't have the WIN32 help files available right
now - and now win32 compiler either... :-)
bool is_same_week(SYSTEMTIME& s1,SYSTEMTIME& s2) {
FILETIME f1,f2;
ULARGE_INTEGER u1,u2;
#ifndef ALLOW_S2_LESS_THAN_S1
if (s2.wDayofWeek < s1.wDayOfWeek)
/* Given the assumption that s2 must be larger than s1,
* they can't be in same week unless s2 has weekday
* >= s1.
*/
return false;
#endif // ALLOW_S2_LESS_THAN_S1
/* Convert from SYSTEMTIME to a single numeric value */
SystemTimeToFileTime(&s1,&f1);
SystemTimeToFileTime(&s2,&f2);
u1.LowPart = f1.dwLowDateTime;
u1.HighPart = f1.dwHighDateTime;
u2.LowPart = f2.dwLowDateTime;
u2.HighPart = f2.dwHighDateTime;
/* Now have time in 100-nanosecond steps */
#ifdef ALLOW_S2_LESS_THAN_S1
/* if s1 <= s2 isn't a requirement then remove first if case and
* insert this instead
*/
if (u1.QuadPart < u2.QuadPart) {
if (s2.wDayOfWeek < s1.wDayOfWeek) return false;
} else {
if (s1.wDayOfWeek < s2.wDayOfWeek) return false;
tmp = u1.QuadPart;
u1.QuadPart = u2.QuadPart;
u2.QuadPart = tmp;
}
#endif // ALLOW_S2_LESS_THAN_S1
if (u2.QuadPart < u1.QuadPart)
/* End of time interval before start... */
return false;
if (u2.QuadPart > u1.QuadPart > 7*24*3600*(ULONGLONG)(10000000))
/* s2 is more than 7 days away, so can't be in same week. */
return false;
return true;
}
/Per W
On Sat, 9 Nov 2002, Zodiaq wrote:
> Hello Dev-cpp-users,
>
> yeah, I know this is an off topic question - it is not directly
> related to development od Dev-C++ but I also know that this mailing
> list reads quite few people so - do you know a good way to check if
> two dates are inside one week... dates are in SYSTEMTIME or FILETIME
> format... my present idea is not as good as I wish it to be - I start
> from first date and try to get to the second one - if I pass sutarday
> and still not in second I know that weeks are different... but this
> forces some comparisons... know I think that I might check in which
> week of the year both dates are - but how to do that? So - if you have
> any brilliant ideas share them with me!
>
> --
> regards, Zodiaq
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> 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: Zodiaq <zo...@ac...> - 2002-11-09 23:36:59
|
Hello Charles and all Dev-C++ users, Sunday, November 10, 2002, 12:16:22 AM, Charles wrote as follows: C> You might check in Jeff Garland's Date_Time library which is now part of the C> Boost Library as of version 1.29.0. See more at www.boost.org. Thanks for quick help, but I'm trying my best to make my little progs as small as posible - so this means that I wouldn't like to use other libs... and I want to write own code optimized for specyfic problem... waiting for other help :-) C> Chuck -- regards, Zodiaq |
|
From: Charles <cha...@at...> - 2002-11-09 23:22:45
|
Zodiaq - > ...do you know a good way to check if two dates are inside one week... You might check in Jeff Garland's Date_Time library which is now part of the Boost Library as of version 1.29.0. See more at www.boost.org. Check especially date_period. "The class boost::gregorian::date_period provides direct representation for ranges between two dates. Periods provide the ability to simplify some types of calculations by simplifying the conditional logic of the program. For example, testing if a date is within an irregular schedule such as a weekend or holiday can be accomplished using collections of date periods." Chuck |
|
From: Zodiaq <zo...@ac...> - 2002-11-09 22:56:44
|
Hello Dev-cpp-users, yeah, I know this is an off topic question - it is not directly related to development od Dev-C++ but I also know that this mailing list reads quite few people so - do you know a good way to check if two dates are inside one week... dates are in SYSTEMTIME or FILETIME format... my present idea is not as good as I wish it to be - I start from first date and try to get to the second one - if I pass sutarday and still not in second I know that weeks are different... but this forces some comparisons... know I think that I might check in which week of the year both dates are - but how to do that? So - if you have any brilliant ideas share them with me! -- regards, Zodiaq |
|
From: Ioannis V. <no...@ho...> - 2002-11-09 22:10:04
|
> -----Original Message-----
> From: dev...@li...=20
> [mailto:dev...@li...] On Behalf=20
> Of CRV=A7ADER /KY
> Sent: Saturday, November 09, 2002 3:20 PM
> To: dev...@li...
> Subject: [Dev-C++] sscanf() writes out of pointer and program=20
> doesn't segfault
>=20
>=20
> Using the following environment:
> Windows 98
> Dev-C++ 4.9.6.0 with included gcc (2.95.3-6)
>=20
> I compile the following program, *without any optimization*=20
> and with no=20
> additional compiler arguments:
>=20
#include <stdio.h>
>=20
> int main()
> {
> char instr[]=3D"600";
>=20
> short var1=3D800,
> var2=3D-1;
>=20
> printf("%d %d\n",var1,var2);
> sscanf(instr,"%i",&var2);
> printf("%d %d\n",var1,var2);
>=20
> getchar();
> return 0;
> }
>=20
>=20
> output:
> 800 -1
> 0 600
>=20
> expected output:
> 800 -1
> 800 600
>=20
> sscanf overwrites the preceding 2 bytes of RAM (occupied by=20
> var1), since it=20
> thinks that var2 is an int (4 bytes) while actually it is a short (2=20
> bytes), effectively writing out of the given pointer.
>=20
> The fact is, ** program doesn't segfault **.
And? In official ANSI C standard terminology, the result is "undefined
behaviour". That is in your PC something else may be overwritten, a
crash to occur, the plane to crash (if this happens in a plane
navigation code for example).
>=20
> Also, the pointer should require an explicit (int *) cast to=20
> be accepted,=20
> otherwise a warning should occour ("Warning: implicit cast=20
> from "short *"=20
> to "int *"). It would be much useful, if possible.
No. sscanf() is a variadic function and a void * is passed. Depending ob
your argument, a corresponding pointer (int *) is assigned the void *
pointer.
>=20
> if var2 is declared as int instad of short, the problem is corrected.
> if optimizations are used, shorts are padded to int and the=20
> problem doesn't=20
> occour.
In general the resulting behaviour is undefined.
Ioannis Vranos
=20
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys
|
|
From: Daniel G. <sp...@ho...> - 2002-11-09 19:38:35
|
#include <iostream>
int main()
{
using namespace std;
std::cout<<"Hej verden!\n";
return 0;
}
if you use iostream without the .h extention you need the using namespace
std; bit.
post error messages also in future, they will help us get a quick response
to you!
Daniel
>From: "Tina" <ti...@td...>
>To: <dev...@li...>
>Subject: [Dev-C++] new
>Date: Fri, 9 Nov 2001 18:33:22 +0100
>
>Hi
>
>Im new on the list, and in programming, i have tryed a tut but i can´t
>compile it, when i hit compile button, it just says no errors and no
>outputs.
>
>What do i do wrong? any ideas?
>
>Tina
>
>
>
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>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
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
|
|
From: Daniel G. <sp...@ho...> - 2002-11-09 18:10:00
|
post your code for us to see >From: "Tina" <ti...@td...> >To: <dev...@li...> >Subject: [Dev-C++] new >Date: Fri, 9 Nov 2001 18:33:22 +0100 > >Hi > >Im new on the list, and in programming, i have tryed a tut but i can´t >compile it, when i hit compile button, it just says no errors and no >outputs. > >What do i do wrong? any ideas? > >Tina > > > > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >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 _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail |
|
From: Tina <ti...@td...> - 2002-11-09 17:33:35
|
Hi Im new on the list, and in programming, i have tryed a tut but i can´t compile it, when i hit compile button, it just says no errors and no outputs. What do i do wrong? any ideas? Tina |
|
From: Santiago <sa...@ho...> - 2002-11-09 15:44:02
|
Hi Does anyone know if it's possible installing GNU G++ 3.2 in windows = xp? |
|
From: /KY <cru...@in...> - 2002-11-09 13:21:28
|
Using the following environment:
Windows 98
Dev-C++ 4.9.6.0 with included gcc (2.95.3-6)
I compile the following program, *without any optimization* and with no=20
additional compiler arguments:
int main()
{
char instr[]=3D"600";
short var1=3D800,
var2=3D-1;
printf("%d %d\n",var1,var2);
sscanf(instr,"%i",&var2);
printf("%d %d\n",var1,var2);
getchar();
return 0;
}
output:
800 -1
0 600
expected output:
800 -1
800 600
sscanf overwrites the preceding 2 bytes of RAM (occupied by var1), since it=
=20
thinks that var2 is an int (4 bytes) while actually it is a short (2=20
bytes), effectively writing out of the given pointer.
The fact is, ** program doesn't segfault **.
Also, the pointer should require an explicit (int *) cast to be accepted,=20
otherwise a warning should occour ("Warning: implicit cast from "short *"=20
to "int *"). It would be much useful, if possible.
if var2 is declared as int instad of short, the problem is corrected.
if optimizations are used, shorts are padded to int and the problem doesn't=
=20
occour.
Guido Imperiale
cru...@in...
-------------------------------
CRV=A7ADER/KY
KnowledgE is PoweR
|
|
From: Carlos d. M. <cg...@wo...> - 2002-11-09 12:04:29
|
The documentation is that which comes with WIN32 API Programmer's reference (12MB download where I found it, but you can find it on-line at http://msdn.microsoft.com in the section library, which I think you go there adding /library to the url.). I can copy and paste and send you the page if you want. See ld or dllwrap or libtool documentation you can find at http://www.mingw.org in documentation section, add /docs.html, there is a little paragraph with an example of dll. There is a link to a page (http://mefriss1.swan.ac.uk/~jfonseca/gnu-win32/documentation/chm/index.html) where you can download it as a .chm file. There should be a link to some site where it's said something about this matter with gcc. You can reach it through the mumit khan's ports (ported software section), but I'm not sure and I have not it yet. I found a little tutorial at http://www.gamecoding.co.uk called memory management in dlls, it's useful, although not deep, there is a tip about make a dll for classes and portable (oh, yeah!), but I didn't achieve to make it work. Perhaps I'll send a couple of ideas about it to the list for a little of discussion. For more tuts or docs, search at altavista or google |
|
From: Phil <tsy...@ya...> - 2002-11-09 05:22:49
|
Hello all,
An other newbie question.
I have a window (text area) created as follow :
g_hRead = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT" ,
"INPUT",
WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_HSCROLL | ES_MULTILINE
| ES_AUTOVSCROLL | ES_AUTOHSCROLL |
WS_CAPTION,
0, 200, 500,
425,hMainWindow,(HMENU)IDC_MAIN_INPUT,
GetModuleHandle(NULL),NULL);
This window is a "read only" area for the user, i.e. I
do not want the user to be able to enter any text in
it.
The displayed datas (alphanums) are coming from an
other process , char by char.
I want to display the datas as soon as they are coming
in, w/o loosing the ones yet displayed (auto-scroll).
The input volume of datas can be of any length (more
than one visible window) and the user should be able
to save the whole datas into a file on disk at any
moment (but then the data input is stopped).
Is there any other way (more efficient) than using
SetWindowText every time I have an input (which occurs
2-3 times per second) ?
Alternate way I tried w/o success : writing the datas
on the fly in a file opened as "SHARE" by my soft.
Opening it agn for reading (to do a global
SetWindowText) does not help and the reading is done
only when the writing channel is closed. What's the
hint to really have a shared access to the file within
the same process ?
OS used: Win2000 + Dev-C++ 4.9.6.7, Win32GUI compiled
as C++
Thanks for helping.
Phil.
__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2
|
|
From: Ioannis V. <no...@ho...> - 2002-11-09 03:57:47
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Scott Williams > Sent: Thursday, November 07, 2002 10:27 PM > To: Dev-Cpp-Users@Lists. Sourceforge. Net > Subject: [Dev-C++] Is there a "garbage" stream? > > > Hi, > > Here's my problem. I have C code that does a bunch of number > crunching, > spitting out intermediate results to the output files along the way. > However, in some applications, it would be preferable to NOT > write any data > to output files (e.g., when the program is run iteratively in > an nonlinear > optimization routine). > > Rather than hunt through my code to find all the instances of > fprintf(fpout, > ...) and insert a conditional statement, it would be much easier (and > cleaner) if I could simply initialize the file pointer to a > stream going > nowhere. > > I've tried setting fpout = NULL but that doesn't work. Any > suggestions? There is not in standard C. However an implementation may provide one as a system extension. Also you can use a predefined one like stdout or stderr (so as to not write to a file). Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |
|
From: Luigi S. <gi...@li...> - 2002-11-09 03:57:42
|
On Wed, Nov 06, 2002 at 09:31:50PM -0500, Scott Williams wrote: > Hi, > > This is a "C" question (not C++). When printing a number in exponential > format (%e) using printf or one of its friends, three digits are used for > the exponent: > > 1.2345e+006. > > I would like to change this behavior so that the exponent only uses as many > digits as it needs: > > 1.2345e+6 > > I've looked, but this feature does not appear to be built into any of the > format modifiers/switches. Am I missing something and/or is there an easy > way to do this? > > Thnx, > Scott > Hi, Scott Assuming that by "C" you mean C89, the answer is: you are right, there seems to be no built-in way to achieve what you are looking for. However, an easy (probably too simple?) solution could be: - print the value into a string using scientific notation - erase unwanted extra leading zeroes in the exponent To better show the point, I attached an archive with: - a simple implementation of the above function - a short program to test the function - a file with some values I used for the test -- >> gisan >> So you're back... about time... |
|
From: Luigi S. <gi...@li...> - 2002-11-09 03:57:38
|
On Thu, Nov 07, 2002 at 03:26:59PM -0500, Scott Williams wrote:
> Hi,
>
> Here's my problem. I have C code that does a bunch of number crunching,
> spitting out intermediate results to the output files along the way.
> However, in some applications, it would be preferable to NOT write any data
> to output files (e.g., when the program is run iteratively in an nonlinear
> optimization routine).
>
> Rather than hunt through my code to find all the instances of fprintf(fpout,
> ...) and insert a conditional statement, it would be much easier (and
> cleaner) if I could simply initialize the file pointer to a stream going
> nowhere.
>
> I've tried setting fpout = NULL but that doesn't work. Any suggestions?
>
> Scott
>
If all your output goes to one stream, pointed by "fpout", and it
is connected to the same file, then all you need to do is modify
code at the point where you connect the stream to the file.
That means replacing:
...
FILE *fpout = fopen("logfile", "w");
...
with something like:
...
FILE *fpout = fopen((condition) ? "logfile" : "/dev/null", "w");
...
to create a CONDITION, a command line flag could be used; so it is
easy to toggle between keeping and discarding intermediate output.
If you are using Dos/Win, then use "nul" in place of "/dev/null".
Regards
--
>> gisan >>
Q: How can you tell when a Burroughs salesman is lying?
A: When his lips move.
|
|
From: Louis G. <lg...@ya...> - 2002-11-08 21:53:28
|
Carlos, Can you give the doc(s) or tutorial(s) that you mention in your note ? --- Carlos García del Monte <cg...@wo...> wrote: > First of all, I'm not familiar with dlls. But dll is dynamic link > library, which > means the linking takes place at run time, so you haven't to pass any > option > about it to the compiler. You only need: > -Link to the import library, libfoo.a, if you make an implicit dll load. > This > file has an EXPORT table for the functions and variables that will be > exported > from the dll. > -Add the appropriate code to the sources for load it when needed and > unload it > when needed. Such LoadLibrary(hInstance, another parameter?s?) (see > documentation and tutorials) and FreeLibrary(hInstance) and it will link > to it > at run time. If explicit dll load. > > Saikat Kanjilal escribió: > > > Hello: > > I am sort of a newbie at using bloodshed dev-c++. > > I am writing a JNI application to interface with a c library (lets say > the c > > library file is called foo.dll) inside Bloodshed Dev C++ . To do this > I > > want to create a dll from a jni c file that in turn calls a function > inside > > this foo.dll. I was wondering what I need to do in my project > settings to > > link in this dll file , is it the -l or the -o option that is needed > to link > > in a dll.. > > > > Thanks for your help > > SK > > > > _________________________________________________________________ > > MSN 8 with e-mail virus protection service: 2 months FREE* > > http://join.msn.com/?page=features/virus > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: See the NEW Palm > > Tungsten T handheld. Power & Color in a compact size! > > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en > > _______________________________________________ > > 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: See the NEW Palm > Tungsten T handheld. Power & Color in a compact size! > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en > _______________________________________________ > 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!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 |