dev-cpp-users Mailing List for Dev-C++ (Page 316)
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: Matthews <dem...@uw...> - 2003-09-21 12:13:12
|
Still giving me the same crash :\
At 11:32 AM 20/09/2003 +0200, Per Westermark wrote:
>When you allocate buffers for strings, you must allocate room for
>strlen(str)+1
>characters, or the termination character '\0' will not fit.
>
>/Per W
>
>On Fri, 19 Sep 2003, Matthews wrote:
>
>> I'm working on a program to generate makefiles for me, and I currently have
>> it set up to read different sections of a file to generate the options.
>> One section is %input, which has a list of filenames to include, eg.
>>
>> prj.txt
>>
>> %input
>> main.c
>> vid.c
>> gui.c
>>
>> I read these into a struct organized like so:
>>
>> struct prj_info
>> {
>> ...
>> char **input;
>> ...
>> }
>>
>> And I allocate space based on how many files there are (an array of
>> strings, basically)
>>
>> My problem is that I get errors when running the following C code:
>>
>> if(!strncmp("%include",t,strlen(t)-1))
>> {
>> count = 0;
>> skip_line(buf);
>> getword(buf,t);
>> longest_length = strlen(t);
>> info.input = (char *)malloc((sizeof(char)*longest_len)*1);
>> if(!info.input)
>> {
>> printf("OH NOS\n");
>> return 0;
>> }
>> //CRASH HERE
>> strcpy(info.input[count],t);
>> while(*buf!='%')
>> {
>> while(*buf=='#'||isspace(*buf)) skip_line(buf);
>> getword(buf,t);
>> if(strlen(t)>longest_length) longest_length = strlen(t);
>> count++;
>> realloc(info.input,(sizeof(char)*longest_length)*count);
>> if(!info.input)
>> {
>> printf("ERR0RZ\n");
>> return 0;
>> }
>> strcpy(info.input[count],t);
>> skip_line(buf);
>> }
>> }
>>
>> Buf is the dumped contents of a file (like prj.txt), getword() places a
>> word from buf into t and skip_line() skips to the next line in buf.
>>
>> The code compiles fine, but crashes at the first strcpy(). Any help would
>> be appreciated.
>>
>>
>> -------------------------------------------------------
>> 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://www23.brinkster.com/noicys/devcpp/ub.htm
>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>>
>
>
|
|
From: Damien <g_...@ho...> - 2003-09-20 19:20:42
|
<html><div style='background-color:'><DIV> <P>From personal experience, I have found out that reimp.exe and coff2omf.exe only work with non-static libraries (I tried to convert glaux.lib from VC6 to Borland and GCC). I noticed that using </P> <P><STRONG>gcc -c file.cpp</STRONG></P> <P>then renaming the object file created lib<STRONG>file</STRONG>.a works all the time (you may have to use <STRONG>g++</STRONG> if you are using classes). While running a small test to make a static libary, i noticed this in the compiler log </P> <P>make.exe -f "C:\Dev-Cpp\Makefile.win" all<BR>ar r Project1.a file.o <BR>ranlib Project1.a</P> <P><STRONG>ar </STRONG>and <STRONG>ranlib</STRONG> seems to be the command tools you need. Hope that helps.<BR><BR></P></DIV> <DIV></DIV>----Original Message Follows---- <DIV></DIV>From: Carlos García del Monte <SOL...@YA...> <DIV></DIV>To: age...@co... <DIV></DIV>CC: DevCpp User Group <DEV...@LI...> <DIV></DIV>Subject: Re: [Dev-C++] .cpp to .lib or .a <DIV></DIV>Date: Sat, 20 Sep 2003 17:51:54 +0200 <DIV></DIV><mailto:dev...@li...?subject=help><mailto:dev...@li...><mailto:dev...@li...?subject=subscribe> <DIV></DIV>List-Id: Dev-C++ users mailing list <DEV-CPP-USERS.LISTS.SOURCEFORGE.NET> <DIV></DIV><mailto:dev...@li...?subject=unsubscribe><HTTP: forum.php?forum="dev-cpp-users" mailarchive sourceforge.net> <DIV></DIV>X-Original-Date: Sat, 20 Sep 2003 17:51:54 +0200 <DIV></DIV>Return-Path: dev...@li... <DIV></DIV>X-OriginalArrivalTime: 20 Sep 2003 15:55:50.0904 (UTC) FILETIME=[AA333780:01C37F8F] <DIV></DIV> <DIV></DIV>For what I know about it the .a format is the same than the .lib for MSVisual C++ (coff), so you shall only need a rename of the .a file to .lib; if you want use it for Borland, which uses OMF format, you need run coff2omf.exe, which is in the binary folder of Borland. <DIV></DIV>If that doesn't work, then it seems you'll need use reimp, if you need it (I don't think so), email me and I'll send it to you, it's small and it seems not very easy to find. <DIV></DIV> <DIV></DIV>Hope it works. <DIV></DIV> <DIV></DIV>age...@co... wrote: <DIV></DIV> <DIV></DIV>>I have been wanting to write my own library of classes that perform <DIV></DIV>>OpenGL functions in order to reuse code effectivley. I was thinking <DIV></DIV>>about adding the declerations in a .h file, and writing the actual <DIV></DIV>>definitions in a .cpp file, which i would convert to a .lib file. <DIV></DIV>>Dev-C++ uses .a, so would I just run the project static library to <DIV></DIV>>make the .a file, or is there a command line utility which takes a <DIV></DIV>>.cpp file and makes it into a .a file? Thank you for replies in <DIV></DIV>>advance. <DIV></DIV>> <DIV></DIV>>-- <DIV></DIV>>~~Scott Simontis~~ <DIV></DIV>>Programmer <DIV></DIV>> <DIV></DIV>> <DIV></DIV>>------------------------------------------------------- <DIV></DIV>>This sf.net email is sponsored by:ThinkGeek <DIV></DIV>>Welcome to geek heaven. <DIV></DIV>>http://thinkgeek.com/sf <DIV></DIV>>_______________________________________________ <DIV></DIV>>Dev-cpp-users mailing list <DIV></DIV>>Dev...@li... <DIV></DIV>>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm <DIV></DIV>>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users <DIV></DIV>> <DIV></DIV>> <DIV></DIV>> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>------------------------------------------------------- <DIV></DIV>This sf.net email is sponsored by:ThinkGeek <DIV></DIV>Welcome to geek heaven. <DIV></DIV>http://thinkgeek.com/sf <DIV></DIV>_______________________________________________ <DIV></DIV>Dev-cpp-users mailing list <DIV></DIV>Dev...@li... <DIV></DIV>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm <DIV></DIV>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users <DIV></DIV></mailto:dev...@li...?subject=unsubscribe></mailto:dev...@li...?subject=subscribe></mailto:dev...@li...></mailto:dev...@li...?subject=help></div><br clear=all><hr>Add photos to your e-mail with <a href="http://g.msn.com/8HMBEN/2746??PS=">MSN 8.</a> Get 2 months FREE*.</html> |
|
From: <or...@vp...> - 2003-09-20 17:48:57
|
age...@co... wrote: > I have been wanting to write my own library of classes that perform OpenGL > functions in order to reuse code effectivley. I was thinking about adding the > declerations in a .h file, and writing the actual definitions in a .cpp file, > which i would convert to a .lib file. Dev-C++ uses .a, so would I just run the > project static library to make the .a file, or is there a command line utility > which takes a .cpp file and makes it into a .a file? Thank you for replies in > advance. There IS a command line utility which creates archives, or libraries and it comes with Dev-C++ (MinGW). It is called "ar" (archiver). Actually, Dev-C++ uses this. It can create archives from object files. You first need to compile all sources to object files. Type "ar --help" to get a list of comand line options. The most common options are "ar cru <libxxx.a> *.o" In "*.o" * is a wildcard, so ar will get all .o object files and create the archive. A quick'n'dirty way to create an archive (library) of all sources (.cpp and .c) in the current dir, type these 2 commands: g++ -c *.cpp *.c - (compile all .cpp and .c files to objects) ar cru libxxx.a *.o - (create the archive) -- Greetings, Balázs |
|
From: Ed C. <em...@ed...> - 2003-09-20 16:49:09
|
Pascal's message (my rough translation): =20 ************************************************* Hello, =20 I'm starting to program, or at least to compile program source codes for DirectX 9, and I would like to know how to use correctly source codes developped in VC++, because the import method doesn't really work well, = or I have done [lit. seized] something incorrectly. =20 Also, how to use libraries (.lib) directly under Dev-C++, because I've noticed a difference between the libraries for DirectX 9 created by = Dev-C++ and those by the MS SDK. Or, [tell me] how to convert a .lib library to = a .a. =20 P.S. If there are no francophones on your list, tell me. I will try to = write in English. [Ce n'est pas un problem!] ************************************************ =20 I don't know how to answer him, though, so I'll leave the response to others. =20 Pascal - si vous avez besoin d'une traduction du Anglais aux Fran=E7ais, = dites le moi; je serai heureux de traduire. Je ne parle pas le fran=E7ais = aussi bien que les Fran=E7ais, mais j'habitais =E0 Aix en Provence pour une = anne=E9; alors, je peux traduire, au minimum. -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Pascal Sent: Saturday, September 20, 2003 3:52 AM To: dev...@li... Subject: [Dev-C++] Probleme de compilation avec package DIRECT X 9 Bonjour, =20 je commence a programmer,ou plutot compiler des sources programm=E9es = pour Direct X 9 et je voulais savoir comment utiliser correctement des = sources d=E9velopp=E9es sous Visual C++,car la m=E9thode d'import ne marche pas franchement bien ou j'ai mal du saisir quelque chose. Puis utiliser des librairies .lib directement sous DEV C++ car j'ai = remarqu=E9 une difference entre les librairies pour directx9 fournies par DEV C++ = et celle du SDK Microsoft.Ou alors comment faire d'une librairie .lib une librairie .a. =20 PS:si il n'y a pas de Fran=E7ais sur cette liste,dites le = moi,j'essaierai d'=E9crire en Anglais. =20 ++=20 =20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.520 / Virus Database: 318 - Release Date: 18/09/2003 |
|
From: <sol...@ya...> - 2003-09-20 15:54:15
|
For what I know about it the .a format is the same than the .lib for MSVisual C++ (coff), so you shall only need a rename of the .a file to .lib; if you want use it for Borland, which uses OMF format, you need run coff2omf.exe, which is in the binary folder of Borland. If that doesn't work, then it seems you'll need use reimp, if you need it (I don't think so), email me and I'll send it to you, it's small and it seems not very easy to find. Hope it works. age...@co... wrote: >I have been wanting to write my own library of classes that perform OpenGL >functions in order to reuse code effectivley. I was thinking about adding the >declerations in a .h file, and writing the actual definitions in a .cpp file, >which i would convert to a .lib file. Dev-C++ uses .a, so would I just run the >project static library to make the .a file, or is there a command line utility >which takes a .cpp file and makes it into a .a file? Thank you for replies in >advance. > >-- >~~Scott Simontis~~ >Programmer > > >------------------------------------------------------- >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://www23.brinkster.com/noicys/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > |
|
From: <age...@co...> - 2003-09-20 15:00:23
|
I have been wanting to write my own library of classes that perform OpenGL functions in order to reuse code effectivley. I was thinking about adding the declerations in a .h file, and writing the actual definitions in a .cpp file, which i would convert to a .lib file. Dev-C++ uses .a, so would I just run the project static library to make the .a file, or is there a command line utility which takes a .cpp file and makes it into a .a file? Thank you for replies in advance. -- ~~Scott Simontis~~ Programmer |
|
From: Michal M. <mol...@se...> - 2003-09-20 14:58:47
|
Steve Sherman wrote: > I am a student learning basic programming and this is one of the sample > programs that was provided. When I compile and run it I get errors. what errors? > #include "apstring.h" make sure you have apstring.h in the same directory as source |
|
From: Michal M. <mol...@se...> - 2003-09-20 14:54:38
|
Prathmesh Mahidharia wrote: > options", which is supposed to be found in Project --> Project Options > menu. But I cant find that box "Further object files or linker options" > in the latest version. So could anybody plz suggest me an alternate way try Project\Project Options\Parameters tab a write to the Linker box |
|
From: Daniel G. <sp...@ho...> - 2003-09-20 14:20:32
|
I don't think that's it - see he wrote #include <iostream.h> not <iostream>
therefore the namespace issue doesn;t apply.
What are the errors?
>From: Per Westermark <pw...@ia...>
>To: Steve Sherman <she...@ho...>
>CC: dev...@li...
>Subject: Re: [Dev-C++] Student problem
>Date: Sat, 20 Sep 2003 15:46:27 +0200 (CEST)
>
>In the new standard, everything is in the namespace std, so:
>
>std:cin >> ...
>std::cout << ...
>std::string mystring;
>
>/Per W
>
>On Sat, 20 Sep 2003, Steve Sherman wrote:
>
> > I am a student learning basic programming and this is one of the sample
>programs that was provided. When I compile and run it I get errors.
> > Please help.
> >
> > // city.cpp
> > #include <iostream.h>
> > #include "apstring.h"
> > int main()
> > {
> > apstring city_name;
> > unsigned long population;
> > cout << "What is the name of your city or town? ";
> > getline(cin, city_name);
> > cout << "What is the population of the city or town? ";
> > cin >> population;
> > cin.ignore(80,'\n');
> > return 0;
> > }
> >
> >
>__________________________________________________________________________________________________________________________________________________
> > Instant message with integrated webcam using MSN Messenger 6.0. Try it
>now FREE -------------------------------------------------------
> > 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://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
>
>-------------------------------------------------------
>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://www23.brinkster.com/noicys/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Sign-up for a FREE BT Broadband connection today!
http://www.msn.co.uk/specials/btbroadband
|
|
From: Per W. <pw...@ia...> - 2003-09-20 13:47:02
|
In the new standard, everything is in the namespace std, so:
std:cin >> ...
std::cout << ...
std::string mystring;
/Per W
On Sat, 20 Sep 2003, Steve Sherman wrote:
> I am a student learning basic programming and this is one of the sample p=
rograms that was provided. When I compile and run it I get errors.
> Please help.
> =A0
> // city.cpp
> #include <iostream.h>
> #include "apstring.h"
> int main()
> {
> apstring city_name;
> unsigned long population;
> cout << "What is the name of your city or town? ";
> getline(cin, city_name);
> cout << "What is the population of the city or town? ";
> cin >> population;
> cin.ignore(80,'\n');
> return 0;
> }
>
> _________________________________________________________________________=
_________________________________________________________________________
> Instant message with integrated webcam using MSN Messenger 6.0. Try it no=
w FREE -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http:=
//thinkgeek.com/sf _______________________________________________
> Dev-cpp-users mailing list Dev...@li... TO UNSUBSC=
RIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Steve S. <she...@ho...> - 2003-09-20 13:20:38
|
<html><div style='background-color:'><DIV>I am a student learning basic programming and this is one of the sample programs that was provided. When I compile and run it I get errors. Please help.</DIV>
<DIV><A href="mailto:dev-cpp-us"></A> </DIV>
<DIV>// city.cpp </DIV>
<DIV></DIV>#include <iostream.h><IOSTREAM.H>
<DIV></DIV>#include "apstring.h"
<DIV></DIV>
<DIV></DIV>int main()
<DIV></DIV>{
<DIV></DIV>apstring city_name;
<DIV></DIV>unsigned long population;
<DIV></DIV>
<DIV></DIV>cout << "What is the name of your city or town? ";
<DIV></DIV>getline(cin, city_name);
<DIV></DIV>
<DIV></DIV>cout << "What is the population of the city or town? ";
<DIV></DIV>cin >> population;
<DIV></DIV>cin.ignore(80,'\n');
<DIV></DIV>
<DIV></DIV>return 0;
<DIV></DIV>}</div><br clear=all><hr> <a href="http://g.msn.com/8HMBENUS/2737??PS=">Instant message with integrated webcam using MSN Messenger 6.0. Try it now FREE</a> </html>
|
|
From: DarkSaidin <ma...@da...> - 2003-09-20 13:05:52
|
Prathmesh Mahidharia wrote: > Hi all, > I have recently downloaded the latest version of Dev C++ 4.9.8.1. Now, I m trying to configure opengl with it, but I m facing problems and cant compile my programs. Some sites advise to paste the foll. line "-lopengl32 -lglu32 -lglut32" in the box "Further object files or linker options", which is supposed to be found in Project --> Project Options menu. But I cant find that box "Further object files or linker options" in the latest version. So could anybody plz suggest me an alternate way of setting up opengl properly in this new version? Many thanks to all in advance for your time and effort. > Project (menu) -> Project Options (menu entry) -> Parameter (tab) -> Linker (first box on the right, the one with the button below it) The parameters you mentioned will tell the linker to link the libraries opengl32, glu32, glut32 which are stored in you lib folder as libopengl32.a, libglu32.a etc... You could also click the button "Add object/library" and add them manually with their full name. |
|
From: <tel...@ya...> - 2003-09-20 10:03:25
|
Greetings all. Question in relation to an assignment. i need to take in input one character at a time, each character to be followed by a 'carriage return'. i've looked around on the net, but i seem to get differen definitions. Some sources say it's the same as 'newline' others say it resets the relevant cursor to the left of the CURRENT line, and not the newline. It seems the current line definition holds when the '\r' char is used as output, but is this what the 'enter' key performs? can anyone help clarify this? Thanks http://search.yahoo.com.au - Yahoo! Search - Looking for more? Try the new Yahoo! Search |
|
From: Per W. <pw...@ia...> - 2003-09-20 09:46:31
|
If I do
// Example 1
const char* myfunc(int i) {
static char my_buf[10];
sprintf(my_buf,"%d",i);
return my_buf;
}
the my_buf variable is actually a global variable but without a global
name. It is similar to
// Example 2
static char my_buf[10];
const char* myfunc(int i) {
sprintf(my_buf,"%d",i);
return my_buf;
}
with the exception that in the first case, noone in the same or other
source files may access my_buf, while in the second case everyone in the
same source file may access the my_buf[] variable, but the linker will not
export the variable name so code in other files will not be able to access
it.
If I then finally do:
// Example 3
char my_buf[10];
const char* myfunc(int i) {
sprintf(my_buf,"%d",i);
return my_buf;
}
then I'm all the way to a normal global variable, accessible by anyone.
In C++, there is one more alternative for the static keyword:
// Example 4
class MyClass {
protected:
static char my_buf[10];
public:
const char *myfunc(int i);
};
char MyClass::my_buf[10];
const char* MyClass::myfunc(int i) {
sprintf(my_buf,"%d",i);
return my_buf;
}
where everyone inherriting from MyClass may access MyClass::my_buf[]
since it is in the 'protected' section of the class definition, but where
all objects instanced from MyClass or a descendant of MyClass will share
the same variable. This is because MyClass::my_buf[] is a global variable
with a compile-time access restriction - in this case 'protected'.
In short, whenever the static keyword is used, there will be only one
instance of the variable, but depending on where the static keyword is
used, the access scope of the variable will be either a single file, a
sungle function or a single class.
/Per W
On Sat, 20 Sep 2003, Oladipo Odumosu wrote:
> Per Westmark's right, they would share the same variable, tho i'm not sur=
e why... any answers would be appreciated... thanks
>
> NP
>
>
>
>
> ---------------------------------
> Want to chat instantly with your online friends?=A0Get the FREE Yahoo!Mes=
senger
|
|
From: Per W. <pw...@ia...> - 2003-09-20 09:33:24
|
When you allocate buffers for strings, you must allocate room for
strlen(str)+1
characters, or the termination character '\0' will not fit.
/Per W
On Fri, 19 Sep 2003, Matthews wrote:
> I'm working on a program to generate makefiles for me, and I currently have
> it set up to read different sections of a file to generate the options.
> One section is %input, which has a list of filenames to include, eg.
>
> prj.txt
>
> %input
> main.c
> vid.c
> gui.c
>
> I read these into a struct organized like so:
>
> struct prj_info
> {
> ...
> char **input;
> ...
> }
>
> And I allocate space based on how many files there are (an array of
> strings, basically)
>
> My problem is that I get errors when running the following C code:
>
> if(!strncmp("%include",t,strlen(t)-1))
> {
> count = 0;
> skip_line(buf);
> getword(buf,t);
> longest_length = strlen(t);
> info.input = (char *)malloc((sizeof(char)*longest_len)*1);
> if(!info.input)
> {
> printf("OH NOS\n");
> return 0;
> }
> //CRASH HERE
> strcpy(info.input[count],t);
> while(*buf!='%')
> {
> while(*buf=='#'||isspace(*buf)) skip_line(buf);
> getword(buf,t);
> if(strlen(t)>longest_length) longest_length = strlen(t);
> count++;
> realloc(info.input,(sizeof(char)*longest_length)*count);
> if(!info.input)
> {
> printf("ERR0RZ\n");
> return 0;
> }
> strcpy(info.input[count],t);
> skip_line(buf);
> }
> }
>
> Buf is the dumped contents of a file (like prj.txt), getword() places a
> word from buf into t and skip_line() skips to the next line in buf.
>
> The code compiles fine, but crashes at the first strcpy(). Any help would
> be appreciated.
>
>
> -------------------------------------------------------
> 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://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Prathmesh M. <P.M...@mu...> - 2003-09-20 08:09:28
|
Hi all, I have recently downloaded the latest version of Dev C++ 4.9.8.1. = Now, I m trying to configure opengl with it, but I m facing problems and = cant compile my programs. Some sites advise to paste the foll. line = "-lopengl32 -lglu32 -lglut32" in the box "Further object files or linker = options", which is supposed to be found in Project --> Project Options = menu. But I cant find that box "Further object files or linker options" = in the latest version. So could anybody plz suggest me an alternate way = of setting up opengl properly in this new version? Many thanks to all in = advance for your time and effort. |
|
From: Pascal <p.t...@ti...> - 2003-09-20 07:52:55
|
Bonjour, je commence a programmer,ou plutot compiler des sources programm=E9es = pour Direct X 9 et je voulais savoir comment utiliser correctement des = sources d=E9velopp=E9es sous Visual C++,car la m=E9thode d'import ne = marche pas franchement bien ou j'ai mal du saisir quelque chose. Puis utiliser des librairies .lib directement sous DEV C++ car j'ai = remarqu=E9 une difference entre les librairies pour directx9 fournies = par DEV C++ et celle du SDK Microsoft.Ou alors comment faire d'une = librairie .lib une librairie .a. PS:si il n'y a pas de Fran=E7ais sur cette liste,dites le = moi,j'essaierai d'=E9crire en Anglais. ++=20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.520 / Virus Database: 318 - Release Date: 18/09/2003 |
|
From: <gen...@ya...> - 2003-09-20 03:26:24
|
here are some links that have been useful to me: http://www.winprog.org http://www.relisoft.com/win32 http://www.catch22.org.uk/tuts/ http://www.foosyerdoos.fsnet.co.uk also, the BlackSun Research Facility (http://bsrf.box.sk) has some tutorials on Win32. as far as books are concerned, you can get "Programming Windows" by Charles Petzold, and "Programming Applications for Microsot Windows" by Jeffery Richter. cheers NP --------------------------------- Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger |
|
From: <gen...@ya...> - 2003-09-20 02:59:10
|
Per Westmark's right, they would share the same variable, tho i'm not sure why... any answers would be appreciated... thanks NP --------------------------------- Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger |
|
From: <gen...@ya...> - 2003-09-20 02:51:55
|
Hello,
just in case no person has answered this (though i believe someone has), the answer is each object will have its own instance of the variable. in this case, the variable is simply a regular static variable in a function, and all the normal rules for static variable declared in a function apply.
cheers
NP
Bjorn Terelius <bjo...@ho...> wrote:
If a static variable is declared inside a member function of a class, what
would happen?
That is, would all instances of the class use the same value, or would each
instance have its own copy of the variable?
The function is defined something like this:
int Array::unshift() // unshift
{
static int *active=first;
// the function is supposed to return the i:th element on the i:th call
}
Thanks for any help
Bjorn Terelius
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger |
|
From: <or...@vp...> - 2003-09-20 00:50:58
|
André Macário Barros wrote: > In C codes, some functions don´t need the > respective #include header file command, like > printf, system(blah...), etc. They DO need the headers. Use the -Wall flag to see what happens, if you don't use the header. It will tell you something like: prog.c:11: warning: implicit declaration of function `printf' That is, printf is implicitly declared by the call to it. Now you probably wonder: "OK, that's fine, but shouldn't there be some linker error?" The question is right, there should be. But as far as I know, gcc (more accurately: mingw, dunno about other OSes) automatically links with a few system libs. Like "g++" is actually "gcc ... -lstdc++", so g++ automatically links with -lstdc++. Like this, gcc (mingw) links with -lm for example, and some other libs. But anyhow, you should ALWAYS include the respective header file for the function to make portable code. Use -Wall to see if you missed something. -- Greetings, Balázs |
|
From: Matthews <dem...@uw...> - 2003-09-19 20:23:37
|
I'm working on a program to generate makefiles for me, and I currently have
it set up to read different sections of a file to generate the options.
One section is %input, which has a list of filenames to include, eg.
prj.txt
%input
main.c
vid.c
gui.c
I read these into a struct organized like so:
struct prj_info
{
...
char **input;
...
}
And I allocate space based on how many files there are (an array of
strings, basically)
My problem is that I get errors when running the following C code:
if(!strncmp("%include",t,strlen(t)-1))
{
count = 0;
skip_line(buf);
getword(buf,t);
longest_length = strlen(t);
info.input = (char *)malloc((sizeof(char)*longest_len)*1);
if(!info.input)
{
printf("OH NOS\n");
return 0;
}
//CRASH HERE
strcpy(info.input[count],t);
while(*buf!='%')
{
while(*buf=='#'||isspace(*buf)) skip_line(buf);
getword(buf,t);
if(strlen(t)>longest_length) longest_length = strlen(t);
count++;
realloc(info.input,(sizeof(char)*longest_length)*count);
if(!info.input)
{
printf("ERR0RZ\n");
return 0;
}
strcpy(info.input[count],t);
skip_line(buf);
}
}
Buf is the dumped contents of a file (like prj.txt), getword() places a
word from buf into t and skip_line() skips to the next line in buf.
The code compiles fine, but crashes at the first strcpy(). Any help would
be appreciated.
|
|
From: Luigi S. <gi...@li...> - 2003-09-19 20:12:51
|
On Thu, Sep 18, 2003 at 08:21:01PM +0200, kom...@eu... wrote: > I tried both perfect and imperfect dependency with no luck. now I would > like to get Dev-CPP sources and fix it myself > [...] Dev-C++ not including header files in the dependency of a source file, is a long time bug (it even affected the last stable version). Good luck fixing it. -- >> gisan >> |
|
From: <and...@su...> - 2003-09-19 20:08:17
|
Dear Users, I think I´ve made this question about one year ago, but I lost the e-mail :-) -->What is said in the standartization point of view to start programing C codes today with "int main" funcions and no more with "void main" functions? Regards Andre |
|
From: Nathan S. <liv...@ho...> - 2003-09-19 20:02:40
|
> > hi to all, > > Can anyone suggest a good tutorial for win32 programming... > > Thanks in advance > > rgds > > smitha > > > > > Try the Forger's Win32 tutorial on www.winprog.org One of these days I will teach myself how to do this :) I have to do my Uni stuff right now but :( they teach us Java after 3 subjects of C++ for some reason. Are there principles that can carry over to Win32 programming in C++ from that? Nathan |