Re: [Dev-C++] Help me.... strange char functions on MinGW
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
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 |