dev-cpp-users Mailing List for Dev-C++ (Page 24)
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: frederico s. <fre...@gm...> - 2008-09-11 21:33:06
|
Hello, I need import some functions of a .dll on linux. I using kernel 2.6.24, Ubuntu 8.04 server edition. tanks |
From: Al W. <86...@go...> - 2008-09-02 09:38:10
|
Hi: Hi Community, I habe written a small program which works fine, by printing the results to the screen . Having taken a look at the MS XP developers helpside, I have now modified the C++ code as follows: { fprintf(stdprn, " 9bB 6dB 3dB 0dB\n"); fprintf(stdprn, " freq dB | | | | \n"); } but to now avail, would you be able to offer a solution, which can be implemented without using the full windows API ? Your help is much appreciated and all comments are welcome. Kind regards Al: |
From: hhh h. <the...@ho...> - 2008-08-26 09:08:07
|
Hi Dev-C++ Newsletter members. Let me apologize up-front for not asking a Dev-C++ question. Today I'm going to ask about GDT/IDT/LDT (x86 Tables for entering Pmode). I have been reading about GDT and I must say that I'm not getting it right. I'm fairly certain that GDT is a table that should hold diferent entries for Code/Data/Stack segments... But, If I want to allow Multitasking/paging do I have to Create multiple Code,Data and Stack Segments? And TSS ? Must I Create entries related to TSS? Help would be must appreciated. _________________________________________________________________ Cansado de espaço para só 50 fotos? Conheça o Spaces, o site de relacionamentos com até 6,000 fotos! http://www.amigosdomessenger.com.br |
From: Per W. <pw...@ia...> - 2008-08-15 21:19:00
|
The ... is called an ellipsis. You should take a closer look at the stdarg.h include file. The function names and macros in that file are excellent to use in Google :) By the way: Please try to limit yourself to text-only mails to this list. Most mailing lists are text-only. /pwm On Fri, 15 Aug 2008, angel dario wrote: > > > I've being wanting to use the ... thing (sorry I don't know the name) on my functions but I don't know how to use it. > I looked on google I couldn't find anything. > > Can someone provide me with the information on how to use it? at least a website? > > If you are wandering what's the ... about is the thing that printf and scanf uses. for example: > > printf(const char*, ...); > > Thanks. > Y_Y > _________________________________________________________________ > Get thousands of games on your PC, your mobile phone, and the web with Windows®. > http://clk.atdmt.com/MRT/go/108588800/direct/01/ |
From: angel d. <sci...@ho...> - 2008-08-15 21:02:49
|
I've being wanting to use the ... thing (sorry I don't know the name) on my functions but I don't know how to use it. I looked on google I couldn't find anything. Can someone provide me with the information on how to use it? at least a website? If you are wandering what's the ... about is the thing that printf and scanf uses. for example: printf(const char*, ...); Thanks. Y_Y _________________________________________________________________ Get thousands of games on your PC, your mobile phone, and the web with Windows®. http://clk.atdmt.com/MRT/go/108588800/direct/01/ |
From: Per W. <pw...@ia...> - 2008-08-12 18:05:27
|
We can't even understand your question, so you have to help yourself by writing a better problem description. You can use the OpenSSL library to write a program to talk with other SSL/TLS clients. You can use OpenSSH or PuTTY if you want programs to connect to an SSH server. They can also be started from another program, if you just want to perform file transfers. /pwm On Tue, 12 Aug 2008, hilmy wrote: > hi > how can i connect linex server from windows pc, using c++ is there any way > to use SSH. in c++ > pls help me > > > > thank u > hilmy > |
From: hilmy <hi...@gm...> - 2008-08-12 03:21:49
|
hi how can i connect linex server from windows pc, using c++ is there any way to use SSH. in c++ pls help me thank u hilmy |
From: Per W. <pw...@ia...> - 2008-08-07 13:00:01
|
You normally don't have to limit yourself to the internals of the cache coherency of the processor. Different processors either have individual caches that snoops the memory bus, or the different cores have a common cache. This is noramly only important when developing efficient lock and wait functions (signals, mutexes, ...) and the implementation is normally supplied by the OS or the RTL. The big question here is: How do you rewrite an algorithm to allow the job to be split between multiple threads. The big problem isn't how the individual processors or cores keeps track of read or written memory, but how you can produce large execution blocks that do not need any synchronization with a different thread. When you can split the job into lengthy runs without synchronization, then the next optimization step is to think about locality-of-reference - how you can make maximum use of the processor cache. For sorting, you can look into multi-pass merge-sorts. This is an algorithm used when you don't have enough memory to perform in-memory sort of all data, so you split it into multiple blocks that you sort. Then you merge the sorted blocks into a final result. http://en.wikipedia.org/wiki/Merge_sort If you want to, you can modify the merge sort to perform quick-sort of sub-blocks before the merge, instead of running merge sort all the way. /pwm On Thu, 7 Aug 2008, Felix Schmidt wrote: > Dear, > > I've some questions to c++ and parallism. > > Is there any body who knows something about the parallism algorithm of an intel core duo or core quad processor? How Intel implements shared memory access? How implement intel memory or data locality? > > How can I use all my cores for a multithreaded program or algorithm (i.e. parallel merge or quick sort) > > Please Help me > > Best regards > pontix > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > 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: Felix S. <fel...@we...> - 2008-08-07 12:32:04
|
Dear, I've some questions to c++ and parallism. Is there any body who knows something about the parallism algorithm of an intel core duo or core quad processor? How Intel implements shared memory access? How implement intel memory or data locality? How can I use all my cores for a multithreaded program or algorithm (i.e. parallel merge or quick sort) Please Help me Best regards pontix |
From: Per W. <pw...@ia...> - 2008-08-05 04:12:19
|
A strset() that allocates own memory would be quite meaningless - why take a buffer parameter as input, if the buffer is only used to figure out a buffer size? It would be reasonable that a strset() behaves similarly to a memset(). And just as with memset(), the caller is responsible for supplying correct input parameters. /pwm On Tue, 5 Aug 2008, hilmy wrote: > try this > > > #include <stdio.h> > using namespace std; > > char *strset(const char *s, char ch); > > main() > { > printf("%s", strset("TEST, TEST", 'c') ); > getchar(); > } > char *strset(const char *s, char ch) > { > int i; > char *x; > x=new char[sizeof(s)+1]; > for(i = 0; s[i]!='\0'; i++) x[i] = ch; > x[i]='\0'; > return x; > } > > > thank u, > hilmy |
From: hilmy <hi...@gm...> - 2008-08-05 04:03:33
|
try this #include <stdio.h> using namespace std; char *strset(const char *s, char ch); main() { printf("%s", strset("TEST, TEST", 'c') ); getchar(); } char *strset(const char *s, char ch) { int i; char *x; x=new char[sizeof(s)+1]; for(i = 0; s[i]!='\0'; i++) x[i] = ch; x[i]='\0'; return x; } thank u, hilmy On Mon, Aug 4, 2008 at 9:19 AM, <dev...@li... > wrote: > Send Dev-cpp-users mailing list submissions to > dev...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > or, via email, send a message with subject or body 'help' to > dev...@li... > > You can reach the person managing the list at > dev...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Dev-cpp-users digest..." > > > Today's Topics: > > 1. Re: Help me.... strange char functions on MinGW (Per Westermark) > 2. Re: Help me.... strange char functions on MinGW (Derek Clarke) > 3. Re: Help me.... strange char functions on MinGW (Eric) > 4. Re: Help me.... strange char functions on MinGW (Per Westermark) > 5. Re: Help me.... strange char functions on MinGW > (Rafael Oliveira Lima) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 3 Aug 2008 19:47:18 +0200 (CEST) > From: Per Westermark <pw...@ia...> > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > To: Eric <er...@du...> > Cc: dev...@li... > Message-ID: > <Pin...@ia...> > Content-Type: TEXT/PLAIN; charset=ISO-8859-1 > > "I was taught on day one of C/C++ to use 'void main()'" > > You where taught wrong. > > main() should always return int, _unless_ you are working with embedded > programming, where there often is no OS to return back to. > > The return value from main() is the return value that the OS will receive > back when the application ends, i.e. can be used by a batch file to decide > how to continue. > > In this case, the compiler will default any missing type declarations to > int, so: > main() { > } > > is a short form of: > int main(void) { > } > > However, it is strongly recommended to always speicfy the int type > explicitly (except in relation to short, long or unsigned, in which case > it is quite common to skip the 'int' part). > > /pwm > > On Sun, 3 Aug 2008, Eric wrote: > > > would it not be be a good idea get into a the practice of useing a bit > more > > than "main()" > > to start the main function > > I was taught on day one of C/C++ to use "void main()" > > > > > > I know I am pulling out hairs here one by one when I should be giving a > > complete hair cut. > > > > > > maybe I should of re-leant a bit more on "strnset - strset - Set Bytes > in > > String" before replying to question > > > > > > >From Eric > > > > ----- Original Message ----- > > From: Derek Clarke <de...@ci...> > > To: Rafael Oliveira Lima <raf...@gm...> > > Cc: <dev...@li...> > > Sent: Sunday, August 03, 2008 10:05 AM > > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > > > > When you type strset("TEST, TEST", 'c') you've pointed parameter s at > > the static string "TEST, TEST". That string can be put in a read only > > segment by the compiler, hence the access violation when you try and > > write to it. > > > > Not all implementations will do the same thing, hence it works in some > > circumstances. > > > > It is much better to keep writable data and read only initialisor data > > apart. > > > > so: > > > > main() > > { > > static char str[] = "TEST, TEST"; > > printf("%s", strset(str, 'c') ); > > getchar(); > > } > > > > This might look superficially the same, but this time str and the > > initialisor data "TEST, TEST" are two different things, and str will > > definitely be writable. > > > > Also for(i = 0; s[i]; i++) is syntactically correct, but it's really bad > > form. > > > > Better to write > > > > for(i = 0; s[i] != '\0' ; i++) > > > > making the test explicit. > > > > > > > > > > On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima > > <raf...@gm...> wrote: > > > Hi All. > > > > > > I'm learning C with Dev-C++ and MinGW and a wrote such function like > this: > > > > > > #include <stdio.h> > > > > > > char *strset(char *s, char ch); > > > > > > main() > > > { > > > printf("%s", strset("TEST, TEST", 'c') ); > > > getchar(); > > > } > > > > > > char *strset(char *s, char ch) > > > { > > > int i; > > > > > > for(i = 0; s[i]; i++) > > > s[i] = ch; > > > > > > return s; > > > } > > > > > > that would have to fill the string argument with the char ('c') and > print > > > it. > > > > > > string: "TEST, TEST" > > > result: "**************" > > > > > > But, I have a Access Violation, and program crashes. > > > > > > I've tried to compile in LCCWin32 and runs fine. > > > Then, I've tried, again, to compile in mingw and ran on MSYS, > suprise.... > > > works fine too. > > > > > > But in a DOS shell, the same mingw compiled program gives me a Access > > > Violation... Why!!!!???? > > > > > > Please Help... > > > -- > > > Rafael Oliveira de Lima > > > > > > T?cnico Eletr?nico - Projectus NDT. > > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > > Build the coolest Linux based applications with Moblin SDK & win great > > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the > world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > 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 > > > > > > -- > > No virus found in this incoming message. > > Checked by AVG. > > Version: 7.5.524 / Virus Database: 270.5.10/1587 - Release Date: > 02-Aug-08 > > 17:30 > > > > > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > > Build the coolest Linux based applications with Moblin SDK & win great > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the > world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > ------------------------------ > > Message: 2 > Date: Sun, 3 Aug 2008 21:38:34 +0100 > From: "Derek Clarke" <de...@ci...> > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > To: dev...@li... > Message-ID: > <efe...@ma...> > Content-Type: text/plain; charset=ISO-8859-1 > > There's a key dfference between C and C++ here. > > in C int main() means main will accept any number of parameters in any > order, whereas in C++ int main() is the same as the c int main(void), > i.e. main takes no parameters. > > Strictly they're both wrong though. In most operating systems the > signature of main is in fact > > int main(int argc, char* argv[]); > > This is so command line arguments can be passed. > > On Sun, Aug 3, 2008 at 6:47 PM, Per Westermark <pw...@ia...> > wrote: > > "I was taught on day one of C/C++ to use 'void main()'" > > > > You where taught wrong. > > > > main() should always return int, _unless_ you are working with embedded > > programming, where there often is no OS to return back to. > > > > The return value from main() is the return value that the OS will receive > > back when the application ends, i.e. can be used by a batch file to > decide > > how to continue. > > > > In this case, the compiler will default any missing type declarations to > > int, so: > > main() { > > } > > > > is a short form of: > > int main(void) { > > } > > > > However, it is strongly recommended to always speicfy the int type > > explicitly (except in relation to short, long or unsigned, in which case > > it is quite common to skip the 'int' part). > > > > /pwm > > > > On Sun, 3 Aug 2008, Eric wrote: > > > >> would it not be be a good idea get into a the practice of useing a bit > more > >> than "main()" > >> to start the main function > >> I was taught on day one of C/C++ to use "void main()" > >> > >> > >> I know I am pulling out hairs here one by one when I should be giving a > >> complete hair cut. > >> > >> > >> maybe I should of re-leant a bit more on "strnset - strset - Set Bytes > in > >> String" before replying to question > >> > >> > >> >From Eric > >> > >> ----- Original Message ----- > >> From: Derek Clarke <de...@ci...> > >> To: Rafael Oliveira Lima <raf...@gm...> > >> Cc: <dev...@li...> > >> Sent: Sunday, August 03, 2008 10:05 AM > >> Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > >> > >> > >> When you type strset("TEST, TEST", 'c') you've pointed parameter s at > >> the static string "TEST, TEST". That string can be put in a read only > >> segment by the compiler, hence the access violation when you try and > >> write to it. > >> > >> Not all implementations will do the same thing, hence it works in some > >> circumstances. > >> > >> It is much better to keep writable data and read only initialisor data > >> apart. > >> > >> so: > >> > >> main() > >> { > >> static char str[] = "TEST, TEST"; > >> printf("%s", strset(str, 'c') ); > >> getchar(); > >> } > >> > >> This might look superficially the same, but this time str and the > >> initialisor data "TEST, TEST" are two different things, and str will > >> definitely be writable. > >> > >> Also for(i = 0; s[i]; i++) is syntactically correct, but it's really > bad > >> form. > >> > >> Better to write > >> > >> for(i = 0; s[i] != '\0' ; i++) > >> > >> making the test explicit. > >> > >> > >> > >> > >> On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima > >> <raf...@gm...> wrote: > >> > Hi All. > >> > > >> > I'm learning C with Dev-C++ and MinGW and a wrote such function like > this: > >> > > >> > #include <stdio.h> > >> > > >> > char *strset(char *s, char ch); > >> > > >> > main() > >> > { > >> > printf("%s", strset("TEST, TEST", 'c') ); > >> > getchar(); > >> > } > >> > > >> > char *strset(char *s, char ch) > >> > { > >> > int i; > >> > > >> > for(i = 0; s[i]; i++) > >> > s[i] = ch; > >> > > >> > return s; > >> > } > >> > > >> > that would have to fill the string argument with the char ('c') and > print > >> > it. > >> > > >> > string: "TEST, TEST" > >> > result: "**************" > >> > > >> > But, I have a Access Violation, and program crashes. > >> > > >> > I've tried to compile in LCCWin32 and runs fine. > >> > Then, I've tried, again, to compile in mingw and ran on MSYS, > suprise.... > >> > works fine too. > >> > > >> > But in a DOS shell, the same mingw compiled program gives me a Access > >> > Violation... Why!!!!???? > >> > > >> > Please Help... > >> > -- > >> > Rafael Oliveira de Lima > >> > > >> > T?cnico Eletr?nico - Projectus NDT. > >> > > >> > >> > ------------------------------------------------------------------------- > >> This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > >> Build the coolest Linux based applications with Moblin SDK & win great > >> prizes > >> Grand prize is a trip for two to an Open Source event anywhere in the > world > >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >> _______________________________________________ > >> 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 > >> > >> > >> -- > >> No virus found in this incoming message. > >> Checked by AVG. > >> Version: 7.5.524 / Virus Database: 270.5.10/1587 - Release Date: > 02-Aug-08 > >> 17:30 > >> > >> > >> > >> > >> > ------------------------------------------------------------------------- > >> This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > >> Build the coolest Linux based applications with Moblin SDK & win great > prizes > >> Grand prize is a trip for two to an Open Source event anywhere in the > world > >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >> _______________________________________________ > >> Dev-cpp-users mailing list > >> Dev...@li... > >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > >> > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > > Build the coolest Linux based applications with Moblin SDK & win great > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the > world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > ------------------------------ > > Message: 3 > Date: Mon, 4 Aug 2008 09:38:05 +1200 > From: "Eric" <eri...@wo...> > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > To: <dev...@li...> > Message-ID: <001b01c8f5b1$37aa8e00$8e60d3cb@one> > Content-Type: text/plain; charset="iso-8859-1" > > No I think at the time it was right but maybe the rules have been changed > and now it is wrong. > > > > > > > ----- Original Message ----- > From: Per Westermark <pw...@ia...> > To: Eric <er...@du...> > Cc: <dev...@li...> > Sent: Monday, August 04, 2008 5:47 AM > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > "I was taught on day one of C/C++ to use 'void main()'" > > You where taught wrong. > > main() should always return int, _unless_ you are working with embedded > programming, where there often is no OS to return back to. > > The return value from main() is the return value that the OS will receive > back when the application ends, i.e. can be used by a batch file to decide > how to continue. > > In this case, the compiler will default any missing type declarations to > int, so: > main() { > } > > is a short form of: > int main(void) { > } > > However, it is strongly recommended to always speicfy the int type > explicitly (except in relation to short, long or unsigned, in which case > it is quite common to skip the 'int' part). > > /pwm > > On Sun, 3 Aug 2008, Eric wrote: > > > would it not be be a good idea get into a the practice of useing a bit > more > > than "main()" > > to start the main function > > I was taught on day one of C/C++ to use "void main()" > > > > > > I know I am pulling out hairs here one by one when I should be giving a > > complete hair cut. > > > > > > maybe I should of re-leant a bit more on "strnset - strset - Set Bytes > in > > String" before replying to question > > > > > > >From Eric > > > > ----- Original Message ----- > > From: Derek Clarke <de...@ci...> > > To: Rafael Oliveira Lima <raf...@gm...> > > Cc: <dev...@li...> > > Sent: Sunday, August 03, 2008 10:05 AM > > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > > > > When you type strset("TEST, TEST", 'c') you've pointed parameter s at > > the static string "TEST, TEST". That string can be put in a read only > > segment by the compiler, hence the access violation when you try and > > write to it. > > > > Not all implementations will do the same thing, hence it works in some > > circumstances. > > > > It is much better to keep writable data and read only initialisor data > > apart. > > > > so: > > > > main() > > { > > static char str[] = "TEST, TEST"; > > printf("%s", strset(str, 'c') ); > > getchar(); > > } > > > > This might look superficially the same, but this time str and the > > initialisor data "TEST, TEST" are two different things, and str will > > definitely be writable. > > > > Also for(i = 0; s[i]; i++) is syntactically correct, but it's really bad > > form. > > > > Better to write > > > > for(i = 0; s[i] != '\0' ; i++) > > > > making the test explicit. > > > > > > > > > > On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima > > <raf...@gm...> wrote: > > > Hi All. > > > > > > I'm learning C with Dev-C++ and MinGW and a wrote such function like > this: > > > > > > #include <stdio.h> > > > > > > char *strset(char *s, char ch); > > > > > > main() > > > { > > > printf("%s", strset("TEST, TEST", 'c') ); > > > getchar(); > > > } > > > > > > char *strset(char *s, char ch) > > > { > > > int i; > > > > > > for(i = 0; s[i]; i++) > > > s[i] = ch; > > > > > > return s; > > > } > > > > > > that would have to fill the string argument with the char ('c') and > print > > > it. > > > > > > string: "TEST, TEST" > > > result: "**************" > > > > > > But, I have a Access Violation, and program crashes. > > > > > > I've tried to compile in LCCWin32 and runs fine. > > > Then, I've tried, again, to compile in mingw and ran on MSYS, > suprise.... > > > works fine too. > > > > > > But in a DOS shell, the same mingw compiled program gives me a Access > > > Violation... Why!!!!???? > > > > > > Please Help... > > > -- > > > Rafael Oliveira de Lima > > > > > > T?cnico Eletr?nico - Projectus NDT. > > > > > > > > ------------------------------ > > Message: 4 > Date: Mon, 4 Aug 2008 00:17:38 +0200 (CEST) > From: Per Westermark <pw...@ia...> > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > To: Eric <er...@du...> > Cc: dev...@li... > Message-ID: > <Pin...@ia...> > Content-Type: TEXT/PLAIN; charset=ISO-8859-1 > > In the old TurboC days, there where a lot of programs with void main() but > even then, the return value should have been int, to allow batch files to > test the ERRORLEVEL variable. > > A program not returning with a explicit "return status" - or a call to > exit(status) - will have a return value of 0. > > /pwm > > On Mon, 4 Aug 2008, Eric wrote: > > > No I think at the time it was right but maybe the rules have been changed > > and now it is wrong. > > > > > > > > > > > > > > ----- Original Message ----- > > From: Per Westermark <pw...@ia...> > > To: Eric <er...@du...> > > Cc: <dev...@li...> > > Sent: Monday, August 04, 2008 5:47 AM > > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > > > > "I was taught on day one of C/C++ to use 'void main()'" > > > > You where taught wrong. > > > > main() should always return int, _unless_ you are working with embedded > > programming, where there often is no OS to return back to. > > > > The return value from main() is the return value that the OS will receive > > back when the application ends, i.e. can be used by a batch file to > decide > > how to continue. > > > > In this case, the compiler will default any missing type declarations to > > int, so: > > main() { > > } > > > > is a short form of: > > int main(void) { > > } > > > > However, it is strongly recommended to always speicfy the int type > > explicitly (except in relation to short, long or unsigned, in which case > > it is quite common to skip the 'int' part). > > > > /pwm > > > > On Sun, 3 Aug 2008, Eric wrote: > > > > > would it not be be a good idea get into a the practice of useing a bit > > more > > > than "main()" > > > to start the main function > > > I was taught on day one of C/C++ to use "void main()" > > > > > > > > > I know I am pulling out hairs here one by one when I should be giving a > > > complete hair cut. > > > > > > > > > maybe I should of re-leant a bit more on "strnset - strset - Set Bytes > in > > > String" before replying to question > > > > > > > > > >From Eric > > > > > > ----- Original Message ----- > > > From: Derek Clarke <de...@ci...> > > > To: Rafael Oliveira Lima <raf...@gm...> > > > Cc: <dev...@li...> > > > Sent: Sunday, August 03, 2008 10:05 AM > > > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > > > > > > > When you type strset("TEST, TEST", 'c') you've pointed parameter s at > > > the static string "TEST, TEST". That string can be put in a read only > > > segment by the compiler, hence the access violation when you try and > > > write to it. > > > > > > Not all implementations will do the same thing, hence it works in some > > > circumstances. > > > > > > It is much better to keep writable data and read only initialisor data > > > apart. > > > > > > so: > > > > > > main() > > > { > > > static char str[] = "TEST, TEST"; > > > printf("%s", strset(str, 'c') ); > > > getchar(); > > > } > > > > > > This might look superficially the same, but this time str and the > > > initialisor data "TEST, TEST" are two different things, and str will > > > definitely be writable. > > > > > > Also for(i = 0; s[i]; i++) is syntactically correct, but it's really > bad > > > form. > > > > > > Better to write > > > > > > for(i = 0; s[i] != '\0' ; i++) > > > > > > making the test explicit. > > > > > > > > > > > > > > > On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima > > > <raf...@gm...> wrote: > > > > Hi All. > > > > > > > > I'm learning C with Dev-C++ and MinGW and a wrote such function like > > this: > > > > > > > > #include <stdio.h> > > > > > > > > char *strset(char *s, char ch); > > > > > > > > main() > > > > { > > > > printf("%s", strset("TEST, TEST", 'c') ); > > > > getchar(); > > > > } > > > > > > > > char *strset(char *s, char ch) > > > > { > > > > int i; > > > > > > > > for(i = 0; s[i]; i++) > > > > s[i] = ch; > > > > > > > > return s; > > > > } > > > > > > > > that would have to fill the string argument with the char ('c') and > > print > > > > it. > > > > > > > > string: "TEST, TEST" > > > > result: "**************" > > > > > > > > But, I have a Access Violation, and program crashes. > > > > > > > > I've tried to compile in LCCWin32 and runs fine. > > > > Then, I've tried, again, to compile in mingw and ran on MSYS, > > suprise.... > > > > works fine too. > > > > > > > > But in a DOS shell, the same mingw compiled program gives me a Access > > > > Violation... Why!!!!???? > > > > > > > > Please Help... > > > > -- > > > > Rafael Oliveira de Lima > > > > > > > > T?cnico Eletr?nico - Projectus NDT. > > > > > > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > > Build the coolest Linux based applications with Moblin SDK & win great > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the > world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > ------------------------------ > > Message: 5 > Date: Mon, 4 Aug 2008 00:49:17 -0300 > From: "Rafael Oliveira Lima" <raf...@gm...> > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > To: dev...@li... > Message-ID: > <959...@ma...> > Content-Type: text/plain; charset="iso-8859-1" > > Ok Great People! I really thanks you Eric and Derek to answer my question! > > For now I?m using variables it?s better. > > I thought that's to be a reason for some compilers ( LCCWin32) do what i > said before, but each have particularity. As I prefer the Dev-C++ and MinGW > (3.4.5), it?s better to respect the way of code if I want to port for gcc > on > Linux. > > I pick the advices of making explicit tests ( I tried to make use of pure > logic, but You're right Derek). > > Once again... thanks and regards! > > -- > Rafael Oliveira de Lima > > T?cnico Eletr?nico - Projectus NDT. > > Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 > bits. > (fam?lias PIC12*, PIC14*, PIC16* e PIC18*). > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > ------------------------------ > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > End of Dev-cpp-users Digest, Vol 27, Issue 3 > ******************************************** > |
From: Per W. <pw...@ia...> - 2008-08-04 12:01:27
|
Have you googled for the function name? There are no magic check boxes in the project options. You have to keep track of what libaries your application needs. M$ says: Client: Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95. Server: Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT Server. Header: Declared in Winnetwk.h. Library: Use Mpr.lib. DLL: Requires Mpr.dll. Unicode/ANSI Implemented as WNetAddConnection2W (Unicode) and WNetAddConnection2A (ANSI). /pwm On Mon, 4 Aug 2008, ag...@li... wrote: > Hi, > I'm generating a program which use WNetAddConnection2 function. > The error is: > [Linker Error] undefined reference to `WNetAddConnection2A@16' > I have been see the option project panel but i don't see anything special. > Thanks > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > 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: agenore\@libero\.it <ag...@li...> - 2008-08-04 09:18:03
|
Hi, I'm generating a program which use WNetAddConnection2 function. The error is: [Linker Error] undefined reference to `WNetAddConnection2A@16' I have been see the option project panel but i don't see anything special. Thanks |
From: Rafael O. L. <raf...@gm...> - 2008-08-04 03:56:51
|
And Per Westermark!!! Thanks to about advices of main declarations... I hope do not forgotten someone. 2008/8/4 Rafael Oliveira Lima <raf...@gm...> > I almost forgot Piero.! Thanks you too guy! > > > 2008/8/4 Rafael Oliveira Lima <raf...@gm...> > > Ok Great People! I really thanks you Eric and Derek to answer my question! >> >> For now I´m using variables it´s better. >> >> I thought that's to be a reason for some compilers ( LCCWin32) do what i >> said before, but each have particularity. As I prefer the Dev-C++ and MinGW >> (3.4.5), it´s better to respect the way of code if I want to port for gcc on >> Linux. >> >> I pick the advices of making explicit tests ( I tried to make use of pure >> logic, but You're right Derek). >> >> Once again... thanks and regards! >> >> -- >> Rafael Oliveira de Lima >> >> Técnico Eletrônico - Projectus NDT. >> >> Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 >> bits. >> (famílias PIC12*, PIC14*, PIC16* e PIC18*). >> > > > > -- > Rafael Oliveira de Lima > > Técnico Eletrônico - Projectus NDT. > > Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 > bits. > (famílias PIC12*, PIC14*, PIC16* e PIC18*). > -- Rafael Oliveira de Lima Técnico Eletrônico - Projectus NDT. Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 bits. (famílias PIC12*, PIC14*, PIC16* e PIC18*). |
From: Rafael O. L. <raf...@gm...> - 2008-08-04 03:51:18
|
I almost forgot Piero.! Thanks you too guy! 2008/8/4 Rafael Oliveira Lima <raf...@gm...> > Ok Great People! I really thanks you Eric and Derek to answer my question! > > For now I´m using variables it´s better. > > I thought that's to be a reason for some compilers ( LCCWin32) do what i > said before, but each have particularity. As I prefer the Dev-C++ and MinGW > (3.4.5), it´s better to respect the way of code if I want to port for gcc on > Linux. > > I pick the advices of making explicit tests ( I tried to make use of pure > logic, but You're right Derek). > > Once again... thanks and regards! > > -- > Rafael Oliveira de Lima > > Técnico Eletrônico - Projectus NDT. > > Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 > bits. > (famílias PIC12*, PIC14*, PIC16* e PIC18*). > -- Rafael Oliveira de Lima Técnico Eletrônico - Projectus NDT. Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 bits. (famílias PIC12*, PIC14*, PIC16* e PIC18*). |
From: Rafael O. L. <raf...@gm...> - 2008-08-04 03:49:19
|
Ok Great People! I really thanks you Eric and Derek to answer my question! For now I´m using variables it´s better. I thought that's to be a reason for some compilers ( LCCWin32) do what i said before, but each have particularity. As I prefer the Dev-C++ and MinGW (3.4.5), it´s better to respect the way of code if I want to port for gcc on Linux. I pick the advices of making explicit tests ( I tried to make use of pure logic, but You're right Derek). Once again... thanks and regards! -- Rafael Oliveira de Lima Técnico Eletrônico - Projectus NDT. Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 bits. (famílias PIC12*, PIC14*, PIC16* e PIC18*). |
From: Per W. <pw...@ia...> - 2008-08-03 22:17:52
|
In the old TurboC days, there where a lot of programs with void main() but even then, the return value should have been int, to allow batch files to test the ERRORLEVEL variable. A program not returning with a explicit "return status" - or a call to exit(status) - will have a return value of 0. /pwm On Mon, 4 Aug 2008, Eric wrote: > No I think at the time it was right but maybe the rules have been changed > and now it is wrong. > > > > > > > ----- Original Message ----- > From: Per Westermark <pw...@ia...> > To: Eric <er...@du...> > Cc: <dev...@li...> > Sent: Monday, August 04, 2008 5:47 AM > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > "I was taught on day one of C/C++ to use 'void main()'" > > You where taught wrong. > > main() should always return int, _unless_ you are working with embedded > programming, where there often is no OS to return back to. > > The return value from main() is the return value that the OS will receive > back when the application ends, i.e. can be used by a batch file to decide > how to continue. > > In this case, the compiler will default any missing type declarations to > int, so: > main() { > } > > is a short form of: > int main(void) { > } > > However, it is strongly recommended to always speicfy the int type > explicitly (except in relation to short, long or unsigned, in which case > it is quite common to skip the 'int' part). > > /pwm > > On Sun, 3 Aug 2008, Eric wrote: > > > would it not be be a good idea get into a the practice of useing a bit > more > > than "main()" > > to start the main function > > I was taught on day one of C/C++ to use "void main()" > > > > > > I know I am pulling out hairs here one by one when I should be giving a > > complete hair cut. > > > > > > maybe I should of re-leant a bit more on "strnset - strset - Set Bytes in > > String" before replying to question > > > > > > >From Eric > > > > ----- Original Message ----- > > From: Derek Clarke <de...@ci...> > > To: Rafael Oliveira Lima <raf...@gm...> > > Cc: <dev...@li...> > > Sent: Sunday, August 03, 2008 10:05 AM > > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > > > > When you type strset("TEST, TEST", 'c') you've pointed parameter s at > > the static string "TEST, TEST". That string can be put in a read only > > segment by the compiler, hence the access violation when you try and > > write to it. > > > > Not all implementations will do the same thing, hence it works in some > > circumstances. > > > > It is much better to keep writable data and read only initialisor data > > apart. > > > > so: > > > > main() > > { > > static char str[] = "TEST, TEST"; > > printf("%s", strset(str, 'c') ); > > getchar(); > > } > > > > This might look superficially the same, but this time str and the > > initialisor data "TEST, TEST" are two different things, and str will > > definitely be writable. > > > > Also for(i = 0; s[i]; i++) is syntactically correct, but it's really bad > > form. > > > > Better to write > > > > for(i = 0; s[i] != '\0' ; i++) > > > > making the test explicit. > > > > > > > > > > On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima > > <raf...@gm...> wrote: > > > Hi All. > > > > > > I'm learning C with Dev-C++ and MinGW and a wrote such function like > this: > > > > > > #include <stdio.h> > > > > > > char *strset(char *s, char ch); > > > > > > main() > > > { > > > printf("%s", strset("TEST, TEST", 'c') ); > > > getchar(); > > > } > > > > > > char *strset(char *s, char ch) > > > { > > > int i; > > > > > > for(i = 0; s[i]; i++) > > > s[i] = ch; > > > > > > return s; > > > } > > > > > > that would have to fill the string argument with the char ('c') and > print > > > it. > > > > > > string: "TEST, TEST" > > > result: "**************" > > > > > > But, I have a Access Violation, and program crashes. > > > > > > I've tried to compile in LCCWin32 and runs fine. > > > Then, I've tried, again, to compile in mingw and ran on MSYS, > suprise.... > > > works fine too. > > > > > > But in a DOS shell, the same mingw compiled program gives me a Access > > > Violation... Why!!!!???? > > > > > > Please Help... > > > -- > > > Rafael Oliveira de Lima > > > > > > Técnico Eletrônico - Projectus NDT. > > > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > 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...@wo...> - 2008-08-03 21:40:52
|
No I think at the time it was right but maybe the rules have been changed and now it is wrong. ----- Original Message ----- From: Per Westermark <pw...@ia...> To: Eric <er...@du...> Cc: <dev...@li...> Sent: Monday, August 04, 2008 5:47 AM Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW "I was taught on day one of C/C++ to use 'void main()'" You where taught wrong. main() should always return int, _unless_ you are working with embedded programming, where there often is no OS to return back to. The return value from main() is the return value that the OS will receive back when the application ends, i.e. can be used by a batch file to decide how to continue. In this case, the compiler will default any missing type declarations to int, so: main() { } is a short form of: int main(void) { } However, it is strongly recommended to always speicfy the int type explicitly (except in relation to short, long or unsigned, in which case it is quite common to skip the 'int' part). /pwm On Sun, 3 Aug 2008, Eric wrote: > would it not be be a good idea get into a the practice of useing a bit more > than "main()" > to start the main function > I was taught on day one of C/C++ to use "void main()" > > > I know I am pulling out hairs here one by one when I should be giving a > complete hair cut. > > > maybe I should of re-leant a bit more on "strnset - strset - Set Bytes in > String" before replying to question > > > >From Eric > > ----- Original Message ----- > From: Derek Clarke <de...@ci...> > To: Rafael Oliveira Lima <raf...@gm...> > Cc: <dev...@li...> > Sent: Sunday, August 03, 2008 10:05 AM > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > When you type strset("TEST, TEST", 'c') you've pointed parameter s at > the static string "TEST, TEST". That string can be put in a read only > segment by the compiler, hence the access violation when you try and > write to it. > > Not all implementations will do the same thing, hence it works in some > circumstances. > > It is much better to keep writable data and read only initialisor data > apart. > > so: > > main() > { > static char str[] = "TEST, TEST"; > printf("%s", strset(str, 'c') ); > getchar(); > } > > This might look superficially the same, but this time str and the > initialisor data "TEST, TEST" are two different things, and str will > definitely be writable. > > Also for(i = 0; s[i]; i++) is syntactically correct, but it's really bad > form. > > Better to write > > for(i = 0; s[i] != '\0' ; i++) > > making the test explicit. > > > > > On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima > <raf...@gm...> wrote: > > Hi All. > > > > I'm learning C with Dev-C++ and MinGW and a wrote such function like this: > > > > #include <stdio.h> > > > > char *strset(char *s, char ch); > > > > main() > > { > > printf("%s", strset("TEST, TEST", 'c') ); > > getchar(); > > } > > > > char *strset(char *s, char ch) > > { > > int i; > > > > for(i = 0; s[i]; i++) > > s[i] = ch; > > > > return s; > > } > > > > that would have to fill the string argument with the char ('c') and print > > it. > > > > string: "TEST, TEST" > > result: "**************" > > > > But, I have a Access Violation, and program crashes. > > > > I've tried to compile in LCCWin32 and runs fine. > > Then, I've tried, again, to compile in mingw and ran on MSYS, suprise.... > > works fine too. > > > > But in a DOS shell, the same mingw compiled program gives me a Access > > Violation... Why!!!!???? > > > > Please Help... > > -- > > Rafael Oliveira de Lima > > > > Técnico Eletrônico - Projectus NDT. > |
From: Derek C. <de...@ci...> - 2008-08-03 20:38:37
|
There's a key dfference between C and C++ here. in C int main() means main will accept any number of parameters in any order, whereas in C++ int main() is the same as the c int main(void), i.e. main takes no parameters. Strictly they're both wrong though. In most operating systems the signature of main is in fact int main(int argc, char* argv[]); This is so command line arguments can be passed. On Sun, Aug 3, 2008 at 6:47 PM, Per Westermark <pw...@ia...> wrote: > "I was taught on day one of C/C++ to use 'void main()'" > > You where taught wrong. > > main() should always return int, _unless_ you are working with embedded > programming, where there often is no OS to return back to. > > The return value from main() is the return value that the OS will receive > back when the application ends, i.e. can be used by a batch file to decide > how to continue. > > In this case, the compiler will default any missing type declarations to > int, so: > main() { > } > > is a short form of: > int main(void) { > } > > However, it is strongly recommended to always speicfy the int type > explicitly (except in relation to short, long or unsigned, in which case > it is quite common to skip the 'int' part). > > /pwm > > On Sun, 3 Aug 2008, Eric wrote: > >> would it not be be a good idea get into a the practice of useing a bit more >> than "main()" >> to start the main function >> I was taught on day one of C/C++ to use "void main()" >> >> >> I know I am pulling out hairs here one by one when I should be giving a >> complete hair cut. >> >> >> maybe I should of re-leant a bit more on "strnset - strset - Set Bytes in >> String" before replying to question >> >> >> >From Eric >> >> ----- Original Message ----- >> From: Derek Clarke <de...@ci...> >> To: Rafael Oliveira Lima <raf...@gm...> >> Cc: <dev...@li...> >> Sent: Sunday, August 03, 2008 10:05 AM >> Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW >> >> >> When you type strset("TEST, TEST", 'c') you've pointed parameter s at >> the static string "TEST, TEST". That string can be put in a read only >> segment by the compiler, hence the access violation when you try and >> write to it. >> >> Not all implementations will do the same thing, hence it works in some >> circumstances. >> >> It is much better to keep writable data and read only initialisor data >> apart. >> >> so: >> >> main() >> { >> static char str[] = "TEST, TEST"; >> printf("%s", strset(str, 'c') ); >> getchar(); >> } >> >> This might look superficially the same, but this time str and the >> initialisor data "TEST, TEST" are two different things, and str will >> definitely be writable. >> >> Also for(i = 0; s[i]; i++) is syntactically correct, but it's really bad >> form. >> >> Better to write >> >> for(i = 0; s[i] != '\0' ; i++) >> >> making the test explicit. >> >> >> >> >> On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima >> <raf...@gm...> wrote: >> > Hi All. >> > >> > I'm learning C with Dev-C++ and MinGW and a wrote such function like this: >> > >> > #include <stdio.h> >> > >> > char *strset(char *s, char ch); >> > >> > main() >> > { >> > printf("%s", strset("TEST, TEST", 'c') ); >> > getchar(); >> > } >> > >> > char *strset(char *s, char ch) >> > { >> > int i; >> > >> > for(i = 0; s[i]; i++) >> > s[i] = ch; >> > >> > return s; >> > } >> > >> > that would have to fill the string argument with the char ('c') and print >> > it. >> > >> > string: "TEST, TEST" >> > result: "**************" >> > >> > But, I have a Access Violation, and program crashes. >> > >> > I've tried to compile in LCCWin32 and runs fine. >> > Then, I've tried, again, to compile in mingw and ran on MSYS, suprise.... >> > works fine too. >> > >> > But in a DOS shell, the same mingw compiled program gives me a Access >> > Violation... Why!!!!???? >> > >> > Please Help... >> > -- >> > Rafael Oliveira de Lima >> > >> > Técnico Eletrônico - Projectus NDT. >> > >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> 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 >> >> >> -- >> No virus found in this incoming message. >> Checked by AVG. >> Version: 7.5.524 / Virus Database: 270.5.10/1587 - Release Date: 02-Aug-08 >> 17:30 >> >> >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Per W. <pw...@ia...> - 2008-08-03 17:47:34
|
"I was taught on day one of C/C++ to use 'void main()'" You where taught wrong. main() should always return int, _unless_ you are working with embedded programming, where there often is no OS to return back to. The return value from main() is the return value that the OS will receive back when the application ends, i.e. can be used by a batch file to decide how to continue. In this case, the compiler will default any missing type declarations to int, so: main() { } is a short form of: int main(void) { } However, it is strongly recommended to always speicfy the int type explicitly (except in relation to short, long or unsigned, in which case it is quite common to skip the 'int' part). /pwm On Sun, 3 Aug 2008, Eric wrote: > would it not be be a good idea get into a the practice of useing a bit more > than "main()" > to start the main function > I was taught on day one of C/C++ to use "void main()" > > > I know I am pulling out hairs here one by one when I should be giving a > complete hair cut. > > > maybe I should of re-leant a bit more on "strnset - strset - Set Bytes in > String" before replying to question > > > >From Eric > > ----- Original Message ----- > From: Derek Clarke <de...@ci...> > To: Rafael Oliveira Lima <raf...@gm...> > Cc: <dev...@li...> > Sent: Sunday, August 03, 2008 10:05 AM > Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW > > > When you type strset("TEST, TEST", 'c') you've pointed parameter s at > the static string "TEST, TEST". That string can be put in a read only > segment by the compiler, hence the access violation when you try and > write to it. > > Not all implementations will do the same thing, hence it works in some > circumstances. > > It is much better to keep writable data and read only initialisor data > apart. > > so: > > main() > { > static char str[] = "TEST, TEST"; > printf("%s", strset(str, 'c') ); > getchar(); > } > > This might look superficially the same, but this time str and the > initialisor data "TEST, TEST" are two different things, and str will > definitely be writable. > > Also for(i = 0; s[i]; i++) is syntactically correct, but it's really bad > form. > > Better to write > > for(i = 0; s[i] != '\0' ; i++) > > making the test explicit. > > > > > On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima > <raf...@gm...> wrote: > > Hi All. > > > > I'm learning C with Dev-C++ and MinGW and a wrote such function like this: > > > > #include <stdio.h> > > > > char *strset(char *s, char ch); > > > > main() > > { > > printf("%s", strset("TEST, TEST", 'c') ); > > getchar(); > > } > > > > char *strset(char *s, char ch) > > { > > int i; > > > > for(i = 0; s[i]; i++) > > s[i] = ch; > > > > return s; > > } > > > > that would have to fill the string argument with the char ('c') and print > > it. > > > > string: "TEST, TEST" > > result: "**************" > > > > But, I have a Access Violation, and program crashes. > > > > I've tried to compile in LCCWin32 and runs fine. > > Then, I've tried, again, to compile in mingw and ran on MSYS, suprise.... > > works fine too. > > > > But in a DOS shell, the same mingw compiled program gives me a Access > > Violation... Why!!!!???? > > > > Please Help... > > -- > > Rafael Oliveira de Lima > > > > Técnico Eletrônico - Projectus NDT. > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > 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 > > > -- > No virus found in this incoming message. > Checked by AVG. > Version: 7.5.524 / Virus Database: 270.5.10/1587 - Release Date: 02-Aug-08 > 17:30 > > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > 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...@wo...> - 2008-08-03 02:21:00
|
would it not be be a good idea get into a the practice of useing a bit more than "main()" to start the main function I was taught on day one of C/C++ to use "void main()" I know I am pulling out hairs here one by one when I should be giving a complete hair cut. maybe I should of re-leant a bit more on "strnset - strset - Set Bytes in String" before replying to question >From Eric ----- Original Message ----- From: Derek Clarke <de...@ci...> To: Rafael Oliveira Lima <raf...@gm...> Cc: <dev...@li...> Sent: Sunday, August 03, 2008 10:05 AM Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW When you type strset("TEST, TEST", 'c') you've pointed parameter s at the static string "TEST, TEST". That string can be put in a read only segment by the compiler, hence the access violation when you try and write to it. Not all implementations will do the same thing, hence it works in some circumstances. It is much better to keep writable data and read only initialisor data apart. so: main() { static char str[] = "TEST, TEST"; printf("%s", strset(str, 'c') ); getchar(); } This might look superficially the same, but this time str and the initialisor data "TEST, TEST" are two different things, and str will definitely be writable. Also for(i = 0; s[i]; i++) is syntactically correct, but it's really bad form. Better to write for(i = 0; s[i] != '\0' ; i++) making the test explicit. On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima <raf...@gm...> wrote: > Hi All. > > I'm learning C with Dev-C++ and MinGW and a wrote such function like this: > > #include <stdio.h> > > char *strset(char *s, char ch); > > main() > { > printf("%s", strset("TEST, TEST", 'c') ); > getchar(); > } > > char *strset(char *s, char ch) > { > int i; > > for(i = 0; s[i]; i++) > s[i] = ch; > > return s; > } > > that would have to fill the string argument with the char ('c') and print > it. > > string: "TEST, TEST" > result: "**************" > > But, I have a Access Violation, and program crashes. > > I've tried to compile in LCCWin32 and runs fine. > Then, I've tried, again, to compile in mingw and ran on MSYS, suprise.... > works fine too. > > But in a DOS shell, the same mingw compiled program gives me a Access > Violation... Why!!!!???? > > Please Help... > -- > Rafael Oliveira de Lima > > Técnico Eletrônico - Projectus NDT. > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ 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 -- No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 270.5.10/1587 - Release Date: 02-Aug-08 17:30 |
From: Derek C. <de...@ci...> - 2008-08-02 22:05:52
|
When you type strset("TEST, TEST", 'c') you've pointed parameter s at the static string "TEST, TEST". That string can be put in a read only segment by the compiler, hence the access violation when you try and write to it. Not all implementations will do the same thing, hence it works in some circumstances. It is much better to keep writable data and read only initialisor data apart. so: main() { static char str[] = "TEST, TEST"; printf("%s", strset(str, 'c') ); getchar(); } This might look superficially the same, but this time str and the initialisor data "TEST, TEST" are two different things, and str will definitely be writable. Also for(i = 0; s[i]; i++) is syntactically correct, but it's really bad form. Better to write for(i = 0; s[i] != '\0' ; i++) making the test explicit. On Sat, Aug 2, 2008 at 7:17 PM, Rafael Oliveira Lima <raf...@gm...> wrote: > Hi All. > > I'm learning C with Dev-C++ and MinGW and a wrote such function like this: > > #include <stdio.h> > > char *strset(char *s, char ch); > > main() > { > printf("%s", strset("TEST, TEST", 'c') ); > getchar(); > } > > char *strset(char *s, char ch) > { > int i; > > for(i = 0; s[i]; i++) > s[i] = ch; > > return s; > } > > that would have to fill the string argument with the char ('c') and print > it. > > string: "TEST, TEST" > result: "**************" > > But, I have a Access Violation, and program crashes. > > I've tried to compile in LCCWin32 and runs fine. > Then, I've tried, again, to compile in mingw and ran on MSYS, suprise.... > works fine too. > > But in a DOS shell, the same mingw compiled program gives me a Access > Violation... Why!!!!???? > > Please Help... > -- > Rafael Oliveira de Lima > > Técnico Eletrônico - Projectus NDT. > |
From: Eric <eri...@wo...> - 2008-08-02 21:42:17
|
rats!! I forgot to tell you I changed printf("%s", strset("TEST, TEST", 'c') ); to printf("%s", "TEST, TEST", 'c' ); that is why I thought "there is bound to be a question two" ======> Note the file size of this EMail!!! <======= compared to the last two >From Eric ----- Original Message ----- From: Eric To: Rafael Oliveira Lima ; dev...@li... Sent: Sunday, August 03, 2008 9:09 AM Subject: Re: [Dev-C++] Help me.... strange char functions on MinGW yes well I got a "this program has performed an illegal operation and will shut down" untill I changed main() to int main() in theory it should go int main(int argc, char *argv[]) with a return 0; or maybe something else at the end of the main function the group looks forward to question two on this project try this #include <stdio.h> #include <cstdlib> #include <iostream> char *strset(char *s, char ch); int main() { printf("%s", "TEST, TEST", 'c' ); getchar(); system("PAUSE"); return EXIT_SUCCESS; } char *strset(char *s, char ch) { int i; for(i = 0; s[i]; i++) s[i] = ch; return s; } If you are going to do HTML EMail, do it with class >From Eric ----- Original Message ----- From: Rafael Oliveira Lima To: dev...@li... Sent: Sunday, August 03, 2008 6:17 AM Subject: [Dev-C++] Help me.... strange char functions on MinGW Hi All. I'm learning C with Dev-C++ and MinGW and a wrote such function like this: #include <stdio.h> char *strset(char *s, char ch); main() { printf("%s", strset("TEST, TEST", 'c') ); getchar(); } char *strset(char *s, char ch) { int i; for(i = 0; s[i]; i++) s[i] = ch; return s; } that would have to fill the string argument with the char ('c') and print it. string: "TEST, TEST" result: "**************" But, I have a Access Violation, and program crashes. I've tried to compile in LCCWin32 and runs fine. Then, I've tried, again, to compile in mingw and ran on MSYS, suprise.... works fine too. But in a DOS shell, the same mingw compiled program gives me a Access Violation... Why!!!!???? Please Help... -- Rafael Oliveira de Lima Técnico Eletrônico - Projectus NDT. Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 bits. (famílias PIC12*, PIC14*, PIC16* e PIC18*). |
From: Eric <eri...@wo...> - 2008-08-02 21:12:17
|
yes well I got a "this program has performed an illegal operation and will shut down" untill I changed main() to int main() in theory it should go int main(int argc, char *argv[]) with a return 0; or maybe something else at the end of the main function the group looks forward to question two on this project try this #include <stdio.h> #include <cstdlib> #include <iostream> char *strset(char *s, char ch); int main() { printf("%s", "TEST, TEST", 'c' ); getchar(); system("PAUSE"); return EXIT_SUCCESS; } char *strset(char *s, char ch) { int i; for(i = 0; s[i]; i++) s[i] = ch; return s; } If you are going to do HTML EMail, do it with class >From Eric ----- Original Message ----- From: Rafael Oliveira Lima To: dev...@li... Sent: Sunday, August 03, 2008 6:17 AM Subject: [Dev-C++] Help me.... strange char functions on MinGW Hi All. I'm learning C with Dev-C++ and MinGW and a wrote such function like this: #include <stdio.h> char *strset(char *s, char ch); main() { printf("%s", strset("TEST, TEST", 'c') ); getchar(); } char *strset(char *s, char ch) { int i; for(i = 0; s[i]; i++) s[i] = ch; return s; } that would have to fill the string argument with the char ('c') and print it. string: "TEST, TEST" result: "**************" But, I have a Access Violation, and program crashes. I've tried to compile in LCCWin32 and runs fine. Then, I've tried, again, to compile in mingw and ran on MSYS, suprise.... works fine too. But in a DOS shell, the same mingw compiled program gives me a Access Violation... Why!!!!???? Please Help... -- Rafael Oliveira de Lima Técnico Eletrônico - Projectus NDT. Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 bits. (famílias PIC12*, PIC14*, PIC16* e PIC18*). ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ 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 No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 270.5.10/1584 - Release Date: 31-Jul-08 12:00 |
From: Rafael O. L. <raf...@gm...> - 2008-08-02 18:17:23
|
Hi All. I'm learning C with Dev-C++ and MinGW and a wrote such function like this: #include <stdio.h> char *strset(char *s, char ch); main() { printf("%s", strset("TEST, TEST", 'c') ); getchar(); } char *strset(char *s, char ch) { int i; for(i = 0; s[i]; i++) s[i] = ch; return s; } that would have to fill the string argument with the char ('c') and print it. string: "TEST, TEST" result: "**************" But, I have a Access Violation, and program crashes. I've tried to compile in LCCWin32 and runs fine. Then, I've tried, again, to compile in mingw and ran on MSYS, suprise.... works fine too. But in a DOS shell, the same mingw compiled program gives me a Access Violation... Why!!!!???? Please Help... -- Rafael Oliveira de Lima Técnico Eletrônico - Projectus NDT. Programador Junior e Depurador Assembly em Arquiteturas RISC Microchip 8 bits. (famílias PIC12*, PIC14*, PIC16* e PIC18*). |