dev-cpp-users Mailing List for Dev-C++ (Page 435)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <or...@vp...> - 2003-02-22 21:10:02
|
Greets! > Does Dev-C++ support environment variables at giving include and lib > directories? > > If yes how? At the lib dirs, this works: $(ENV_DIR)/lib etc. Although it seems that Dev-C++ only allows this usage at adding library dirs. It ignores the include dirs, which are like this, and so it doesn't even place them in it's Makefile.win I need help in this, please help. -- Balázs |
|
From: Louis G. <lg...@ya...> - 2003-02-22 20:42:04
|
Ioannis:
the original question was:
RB>Saturday, February 22, 2003, Robson wrote as follows:
RB> Hi! I'm in trouble again! My c++ book does not explain how to redim
an array at run time, preserving contents.
RB> I want to resize an array of sprites every time that user presses
'N' key,
...How does the program below adjust array size at run-time ?
--- Ioannis Vranos <no...@ho...> wrote:
> -------Original Message-------
>
> From: Robson Bernard
> Date: ÓÜââáôï, 22 ÖåâñïõÜñéïò 2003 7:04:19 ìì
> To: C++ Mail List
> Subject: Re: [Dev-C++] Resize Arrays
>
>
> Could you make a simple demo with a vector of ints so i can understand
> it better?
>
> #include <iostream>
> #include <vector>
>
> int main()
> {
> using namespace std;
>
> // An array of 20 integers with initial default value 0
> vector<int> myiarray(20);
>
> // Initial value 1
> vector<double>mydarray(20,1);
>
> myiarray.push_back(7);
>
> // vector::size_type is a typedef of an unsigned integer type.
> // One could use unsigned long in its place for example
> for(vector<int>::size_type i=0; i<myiarray.size(); ++i)
> cout<<myiarray[i]<<endl;
>
> }
>
> Ioannis Vranos
>
> * Programming pages: http://www.noicys.freeurl.com
> * Alternative URL: http://run.to/noicys
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
|
|
From: veenurs <ve...@ma...> - 2003-02-22 20:01:14
|
Hi !
It seems too simple .But what is it !?
if( (buffer = ( PBYTE )calloc( 1000 ,sizeof(BYTE) )) == NULL ){
------
-------
}
size = _msize( buffer );
The size I get it is not 1000 , but 1008 ! Any subsequent call to
realloc does not add the 8 bytes,though .
[ Dev Cpp Version 4.9.7.0 ]
What's happening ?
BTW - "Generate debugging info" is OFF .
Thanks in advance .
-Rahul.
Luigi Santillo wrote:
> Iuri-
> Suppose that your problem is the following: you have a text file (say
> it "script") with lines of different lengths, you wish to load a line
> and print it on the screen until all the lines have been processed.
>
> script
> ------
> aaaaaa
> bbbbb
> iuri
> ------
>
> 1- assume that you know that no line has more than 10 chars
> Here is how I would solve it.
>
> #include <stdio.h>
> #include <assert.h>
>
> #define MAX_LEN 11
> #define FILE_NAME "script"
>
> int main()
> {
> char buf[MAX_LEN];
> FILE *inp = fopen(FILE_NAME, "r");
>
> assert(inp != 0); /* a quick way to report errors */
>
> while (fgets(buf, MAX_LEN, inp))
> printf("%s", buf);
>
> fclose(inp);
>
> return 0;
> }
>
> As you can see the second argument of fgets is the size of the array
> where the line will be stored, not the size of the line that will be
> read. Also keep in mind that fgets will read only MAX_LEN - 1 = 10
> chars, the last one will be used by fgets as the place for the '\0'.
> So when you write:
>
> fgets(linha1_ptr, sizeof(linha1_ptr), script);
>
> It is "strange" (because usually you already know how big a string
> is), but OK, if by "sizeof(linha1_ptr)" you mean the length of the
> string linha1_ptr before the call to fgets, it is not correct if you
> mean: "read the line and get its length, return this length as the
> value of sizeof(linha1_ptr)".
>
> Suppose you say: (assume linha1_ptr is an array of 31 chars)
>
> fgets(linha1_ptr, 31, script); /* and load the string "123\n" */
> /* now sizeof(linha1_ptr) is 4 */
>
> fgets(linha1_ptr, sizeof(linha1_ptr), script); /* trying to load
> "iuri\n" */
> /* fgets will read 3 chars, "iur", the fourth will be '\0' */
>
>
> Of course when you say:
>
> fgets(linha1_ptr, 31, script); /* and load the string "123\n" */
> fgets(linha1_ptr, 31, script); /* trying to load "iuri\n" */
> /* now "iuri" will be loaded as expected */
>
> Hope this clearly explains what should be used as the second argument
> of fgets.
>
> 2 - assume that you do not know the size of the biggest line
> Here is how I would solve it.
>
> #include <stdio.h>
> #include <assert.h>
> #include <string.h>
>
> #define FILE_NAME "script"
> char *getline(FILE *);
>
> int main(int argc, char *argv[])
> {
> char *buf;
> FILE *inp = fopen(FILE_NAME, "r");
>
> assert(inp != 0);
>
> while (buf = getline(inp))
> {
> printf("%s", buf);
> free(buf);
> }
>
> fclose(inp);
> return 0;
> }
>
> /*
> getline = read a line from the file, return the line read.
> The string that is returned is always terminated by a '\n'
> */
>
> #define SIZE 6
> #define GET_MEM (char *)calloc(len + 1, sizeof(char))
>
> char *getline(FILE *file)
> {
> char buf[SIZE];
> char *line = 0;
> int len = 0;
>
> while (fgets(buf, SIZE, file))
> {
> char *tmp = line;
> int n = strlen(buf);
>
> len += n;
> line = GET_MEM;
> assert(line != 0);
>
> if (tmp)
> {
> strcpy(line, tmp);
> free(tmp);
> }
>
> strcat(line, buf);
>
> if (buf[n - 1] == '\n') /* finished reading line */
> break;
> }
>
> return line;
> }
>
> Hope this is of some help
>
> At 14.46 18/07/01 -0300, you wrote:
>
>> Dear Luigi,
>> Thank you for your help. I tried to use calloc because de
>> string read from the
>> file string has diferent sizes. I.e. the first line of the file
>> script is "iuri", when I write:
>> fgets (linha1_ptr ,sizeof(linha1_ptr), script);
>> It returns: iur
>> If I write:
>> fgets (linha1_ptr , 30 , script);
>> It returns: iuri
>>
>> With static memory the problem is that it reads the hole thing:
>> So if my string is:
>> aaaaaaaaaa
>> bbbb
>> With the fgets it will read:
>> aaaaaaaaaa
>> bbbb\0aaaa
>>
>> I think with sizeof it shouldn't happen, but it does. He reads the
>> size of the 1º line and
>> returns this same size for every line, even if it's bigger.
>>
>> Thanks,
>> Iuri
>
>
> ---
> gisan
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: <or...@vp...> - 2003-02-22 17:08:57
|
Hello! I am using my externally self compiled wxWindows. How do I know, which include dirs, library dirs, and libraries do I need to add to the project, when I write a program which uses wxWindows, from Dev-C++? I looked at the makefile, which comes with wxWindows and I digged and copy-pasted the dirs and libs from it. Is this the normal way, or is there a more general one? I am using Dev-C++ 4.9.7.6 (the latest). -- Regards, Balázs P.S.: Please don't forget my previous question. |
|
From: Robson B. <rob...@su...> - 2003-02-22 17:02:44
|
Thanks for input, Zodiac. But im still having some troubles with this: >using std::vector; >vector<SPRITE>mySprites; should i use my own var name - vector<SPRITE>sprites - ? >//and now to add new sprite >SPRITE new; where in the code may i use this? >//here make some adjustments to new object >mySprites.push_back( new ); Should i interpret 'new' you put into the braces as the 'new' directive or as a var name to the new SPRITE? Could you make a simple demo with a vector of ints so i can understand it better? Thanks!!! |
|
From: Zodiaq <zo...@ac...> - 2003-02-22 15:54:29
|
Hello Robson and all Dev-C++ users,
Saturday, February 22, 2003, 4:28:53 PM, Robson wrote as follows:
RB> Hi! I'm in trouble again! My c++ book does not explain how to redim an array
RB> at run time, preserving contents.
RB> I want to resize an array of sprites every time that user presses 'N' key,
RB> to add a new sprite, specified in the following class:
RB> class SPRITE {
RB> public:
RB> int x;
RB> int y;
RB> int sx;
RB> int sy;
RB> long color;
RB> void move(void);
RB> void draw(void);
RB> void erase(void);
RB> };
RB> Any input appreciated.
IMO you should use std:vector...
just do it like this:
#include <vector>
using std::vector;
vector<SPRITE>mySprites;
//and now to add new sprite
SPRITE new;
//here make some adjustments to new object
mySprites.push_back( new );
//to get number of sprites
int count = mySprites.size();
//to get sprite number X
int x = 3;
SPRITE &duck = mySprites[ x ];
it is easy as that!
--
regards, Zodiaq
|
|
From: airam <ai...@so...> - 2003-02-22 15:39:37
|
----- Original Message -----
From: "airam" <ai...@so...>
To: "Per Westermark" <pw...@ia...>
Sent: Saturday, February 22, 2003 5:35 AM
Subject: Re: [Dev-C++] fread
> First of all. If you have a loop to read an integer at a time from a
> file, you better put a write statement WITHIN the loop
> what exactly to write where?sorry i'm not a real programmer)
>
> Second, variable j has room for ONE integer. You try to read countt
> integers into it.
> your comment is right i changed j with *buffer i'm not sure what
buffersize
> is)
>
> Third, you have hardcoded that countt = file size / 4, i.e. assumes that
> the variable j has size 4. While doing the fread(), you suddenly assumes
> that the size of the j integer isn't hardcoded to 4, but is sizeof(x).
> Please inform me what sizeof(x) has do with the size of your input
> buffer.
> countt is how many items i'll read in a file countt=filesize/4 ok i
changed
> sizeof(x) with sizeof(unsigned(int) it's ok?
> i'll build an array for *buffer ok?
>
>
> Fifth. You have a variable 'buffer' that you try to release with a free()
> > call at the end of the program. What were you thinking about using the
> > buffer varable to? Where did you allocate any memory that needs to be
> > released?
> i'll change variable j with *buffer
>
>
> the main idea is (human language)
> get every 4bytes an integer
> see what size is the integer,if size is (between x-y) goto array(k)
> until the end of file
>
>
>
>
> ----- Original Message -----
> From: "Per Westermark" <pw...@ia...>
> To: "airam" <ai...@so...>
> Cc: <dev...@li...>
> Sent: Saturday, February 22, 2003 2:22 PM
> Subject: Re: [Dev-C++] fread
>
>
> > First of all. If you have a loop to read an integer at a time from a
> > file, you better put a write statement WITHIN the loop.
> >
> > Second, variable j has room for ONE integer. You try to read countt
> > integers into it.
> >
> > Third, you have hardcoded that countt = file size / 4, i.e. assumes that
> > the variable j has size 4. While doing the fread(), you suddenly assumes
> > that the size of the j integer isn't hardcoded to 4, but is sizeof(x).
> > Please inform me what sizeof(x) has do with the size of your input
> > buffer.
> >
> > Fourth. Your printout writes out the variable k, while your fread()
tried
> > to put the result into variable j, i.e. you only print out the number of
> > integers - sizeof(x) - read at the last iteration of the loop. If for
some
> > reason feof() or ferror() would return true before entering the loop the
> > first time, your k wouldn't even get initialized.
> >
> > Fifth. You have a variable 'buffer' that you try to release with a
free()
> > call at the end of the program. What were you thinking about using the
> > buffer varable to? Where did you allocate any memory that needs to be
> > released?
> >
> > /Per W
> >
> > On Sat, 22 Feb 2003, airam wrote:
> >
> > > Messagehi!!!!
> > > i want to read a file every 4bytes and get the integer that represent
> 4bytes this is the code (compile successfully)but i don't see nothing!!!!!
> > > whereis is wrong!!!!some help please!!!!
> > > english is not my native language sorry!!!
> > >
> > >
> > > #include <stdio.h>
> > > #include <stdlib.h>
> > >
> > > int main () {
> > > FILE * f;
> > > long size;
> > > int * buffer;
> > > int countt;
> > > int x;
> > > unsigned int j;
> > > unsigned int k;
> > >
> > > f = fopen ( "filename" , "rb" );
> > > if (f==NULL) exit (1);
> > > fseek (f , 0 , SEEK_END);
> > > size = ftell (f);
> > > countt=size/4;
> > > rewind (f);
> > > while (!feof(f) && !ferror(f))
> > > {
> > > k=fread(&j, sizeof(x), countt, f);
> > > }
> > > printf("%d\n",k);
> > > fclose (f);
> > > free (buffer);
> > > return 0;
> > > }
> > >
> > >
> > >
> > >
> >
>
|
|
From: <or...@vp...> - 2003-02-22 15:33:50
|
Hello! Does Dev-C++ support environment variables at giving include and lib directories? If yes how? If no, how can it be emulated? It would be very good to support it, because I am using 2 external libraries (wxWindows(not the DevPak!) and Crystal Space 3D SDK) for my project, and I want to publish it, but the include and lib directories are absolute in Dev-C++, and it would be easier for others if they only set an environment variable, and just hit compile. -- Thank you in advance, Balázs |
|
From: Robson B. <rob...@su...> - 2003-02-22 15:24:51
|
Hi! I'm in trouble again! My c++ book does not explain how to redim an array
at run time, preserving contents.
I want to resize an array of sprites every time that user presses 'N' key,
to add a new sprite, specified in the following class:
class SPRITE {
public:
int x;
int y;
int sx;
int sy;
long color;
void move(void);
void draw(void);
void erase(void);
};
Any input appreciated.
|
|
From: Per W. <pw...@ia...> - 2003-02-22 12:24:01
|
First of all. If you have a loop to read an integer at a time from a
file, you better put a write statement WITHIN the loop.
Second, variable j has room for ONE integer. You try to read countt
integers into it.
Third, you have hardcoded that countt = file size / 4, i.e. assumes that
the variable j has size 4. While doing the fread(), you suddenly assumes
that the size of the j integer isn't hardcoded to 4, but is sizeof(x).
Please inform me what sizeof(x) has do with the size of your input
buffer.
Fourth. Your printout writes out the variable k, while your fread() tried
to put the result into variable j, i.e. you only print out the number of
integers - sizeof(x) - read at the last iteration of the loop. If for some
reason feof() or ferror() would return true before entering the loop the
first time, your k wouldn't even get initialized.
Fifth. You have a variable 'buffer' that you try to release with a free()
call at the end of the program. What were you thinking about using the
buffer varable to? Where did you allocate any memory that needs to be
released?
/Per W
On Sat, 22 Feb 2003, airam wrote:
> Messagehi!!!!
> i want to read a file every 4bytes and get the integer that represent 4bytes this is the code (compile successfully)but i don't see nothing!!!!!
> whereis is wrong!!!!some help please!!!!
> english is not my native language sorry!!!
>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main () {
> FILE * f;
> long size;
> int * buffer;
> int countt;
> int x;
> unsigned int j;
> unsigned int k;
>
> f = fopen ( "filename" , "rb" );
> if (f==NULL) exit (1);
> fseek (f , 0 , SEEK_END);
> size = ftell (f);
> countt=size/4;
> rewind (f);
> while (!feof(f) && !ferror(f))
> {
> k=fread(&j, sizeof(x), countt, f);
> }
> printf("%d\n",k);
> fclose (f);
> free (buffer);
> return 0;
> }
>
>
>
>
|
|
From: airam <ai...@so...> - 2003-02-22 10:49:35
|
Messagehi!!!!
i want to read a file every 4bytes and get the integer that represent =
4bytes this is the code (compile successfully)but i don't see =
nothing!!!!!
whereis is wrong!!!!some help please!!!!
english is not my native language sorry!!!
#include <stdio.h>
#include <stdlib.h>
=20
int main () {
FILE * f;
long size;
int * buffer;
int countt;
int x;
unsigned int j;
unsigned int k;
=20
f =3D fopen ( "filename" , "rb" );
if (f=3D=3DNULL) exit (1);
fseek (f , 0 , SEEK_END);
size =3D ftell (f);
countt=3Dsize/4;
rewind (f);
while (!feof(f) && !ferror(f))
{
k=3Dfread(&j, sizeof(x), countt, f);
}
printf("%d\n",k);
fclose (f);
free (buffer);
return 0;
}
=20
|
|
From: Per W. <pw...@ia...> - 2003-02-22 10:19:26
|
See below - slight fix added.
/Per W
On Sat, 22 Feb 2003, Ioannis Vranos wrote:
> -------Original Message-------
>
> From: airam
> Date: =D3=DC=E2=E2=E1=F4=EF, 22 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 12=
:19:18 =F0=EC
> To: dev...@li...
> Subject: [Dev-C++] fread
>
> Hi!!!!!!
> i want to read a file every 4bytes
> and after printf
> this is the code but doesn't work!!
>
> The above "every 4 bytes" of yours is not clear. I assume you mean "read =
to
> an unsigned int leaving 4 bytes space between two reads in text mode
>
>
>
> #include <stdio.h>
>
> /* For EXIT_FAILURE */
> #include <stdlib.h>
>
> int main()
> {
//> unsigned int j;
unisgned j[2];
> size_t input;
>
>
> FILE *f;
>
> f=3Dfopen("filename","r");
>
> if (!f)
> return EXIT_FAILURE;
>
> /* or do-while(1) */
> while(1)
> {
//> input=3Dfread(&j,sizeof(unsigned int),2,f);
// Need room for two integers, if request is fo two integers.
input=3Dfread(j,*j,2,f);
>
> if(input<2)
> {
> fclose(f);
> return 0;
> }
>
//> printf("%u\n", j);
printf("%u\n",j[0]);
>
// fseek not needed - already eaten away the 'extra' integer.
//> fseek(f,4,SEEK_CUR);
Small seeks forward as in this case - like Iannis I'm assuming the request
was to read every other number, i.e. to read one, skip one, read one...
- should normally be ignored, and the skip be performed by a read to a
temporary buffer until the new target is found. For a number of streams -
redirected input, an encrypted file, ... the stream must anyway perform
the read of the 'skipped' information. Some implementations, especially
encrypted or compressed streams, might support the seek operation, but
instead take a quite expensive synchronization to find the new location to
read from.
Seek backward is even more problematic. A large number of stream
constructs doesn't support a backward seek at all, so it's a good idea
when implementing an algorithm to see if backward seek may be avoided.
>
> }
>
> /* Required in C90 */
> return 0;
>
> }
>
|
|
From: Ioannis V. <no...@ho...> - 2003-02-22 05:34:04
|
-------Original Message-------=0D
=0D
From: airam=0D
Date: =D3=DC=E2=E2=E1=F4=EF, 22 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2003 12=
:19:18 =F0=EC=0D
To: dev...@li...=0D
Subject: [Dev-C++] fread=0D
=0D
Hi!!!!!!=0D
i want to read a file every 4bytes=0D
and after printf=0D
this is the code but doesn't work!!=0D
=0D
The above "every 4 bytes" of yours is not clear. I assume you mean "read =
to
an unsigned int leaving 4 bytes space between two reads in text mode=0D
=0D
=0D
=0D
#include <stdio.h>=0D
=0D
/* For EXIT_FAILURE */=0D
#include <stdlib.h>=0D
=0D
int main()=0D
{=0D
unsigned int j;=0D
size_t input;=0D
=0D
=0D
FILE *f;=0D
=0D
f=3Dfopen("filename","r");=0D
=0D
if (!f)=0D
return EXIT_FAILURE;=0D
=0D
/* or do-while(1) */=0D
while(1)=0D
{=0D
input=3Dfread(&j,sizeof(unsigned int),2,f);=0D
=0D
if(input<2)=0D
{=0D
fclose(f);=0D
return 0;=0D
}=0D
=0D
printf("%u\n", j);=0D
=0D
fseek(f,4,SEEK_CUR);=0D
=0D
}=0D
=0D
/* Required in C90 */=0D
return 0;=0D
=0D
}=0D
=20 |
|
From: Jeeun C. <koo...@ya...> - 2003-02-22 04:12:50
|
hello... actually i jst got dev c++ and..made a simple string program to test.. in the program, i used apstring.h, but it didnt work.. and after that, i used string.h, but that didnt work either. How can i make string work? thanks __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ |
|
From: P.D. v. Z. <pd...@xs...> - 2003-02-21 22:36:14
|
"sizeof file" does not do what you expect it to do. "sizeof" returns the
size of a type or an object, so in your case it returns the size of the
"FILE" struct, not the size of the file you opened.
To correctly loop through the file, you'd use something like:
while (!feof(f) && !ferror(f))
{
fread(&j, sizeof(unsigned int), 2, f);
// the fseek() is not necessary
// if you want to display what you've read from the file, I'd use a
printf() call or similar here
}
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of airam
Sent: Friday, February 21, 2003 11:16 AM
To: dev...@li...
Subject: [Dev-C++] fread
Hi!!!!!!
i want to read a file every 4bytes
and after printf
this is the code but doesn't work!!
#include <stdio.h>
int main()
{
unsigned int i,j,k;
FILE *f;
f=fopen("filename","r");
if (!f)
return 1;
fseek(f,0,SEEK_SET);
for (i=0;i<sizeof file; i++)
{
fread(&j,sizeof(unsigned int),2,f);
fseek(f,sizeof(unsigned int),SEEK_CUR);
}
fclose(f);
printf("\n");
}
|
|
From: airam <ai...@so...> - 2003-02-21 22:16:39
|
Hi!!!!!!
i want to read a file every 4bytes
and after printf
this is the code but doesn't work!!
#include <stdio.h>
int main()
{
unsigned int i,j,k;
FILE *f;
f=3Dfopen("filename","r");
if (!f)
return 1;
fseek(f,0,SEEK_SET);
for (i=3D0;i<sizeof file; i++)
{
fread(&j,sizeof(unsigned int),2,f);
fseek(f,sizeof(unsigned int),SEEK_CUR);
}
fclose(f);
printf("\n");
}
|
|
From: Ioannis V. <no...@ho...> - 2003-02-21 18:46:48
|
http://www.accu.org at the book reviews section.=0D =0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys =0D =0D -------Original Message-------=0D =0D From: Dondolo Mpho=0D Date: =D0=E1=F1=E1=F3=EA=E5=F5=DE, 21 =D6=E5=E2=F1=EF=F5=DC=F1=E9=EF=F2 2= 003 6:55:42 =EC=EC=0D To: dev...@li...=0D Subject: [Dev-C++] Link=0D =0D Hi all, =0D Could anybody please help m with the link for reviewing programming books= =2E I once received a link of its kind from someone but am unable to remember w= hat it was.=0D Kind Regards, =0D Mpho =0D =20 |
|
From: Dondolo M. <MDo...@OL...> - 2003-02-21 16:52:54
|
Hi all, Could anybody please help m with the link for reviewing programming books. I once received a link of its kind from someone but am unable to remember what it was. Kind Regards, Mpho |
|
From: ernesto f. t. <fia...@ho...> - 2003-02-21 16:25:28
|
good day, i need your help in a simple c++ project.. it is a memory card game. you know the one in which you have ti pair up all the cards in order to win. i have to use the graphics library in dev c++ for this project. i'm taking a course on how to program on c++ but i'm just a begginer n by myself i will not be able to make this project. pls send any suggestion on how to do it to may email adress...i would highly appreciated. _________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail |
|
From: ERNESTO F. <fia...@ho...> - 2003-02-21 16:20:24
|
good day, i am a student at a university i Honduras n i need your help = in a simple project in c++. i am taking a course on how to program in = c++ but i'm not as skilled as most of you are because i'm a begginer... my problem is that i have to make a program in dev c++ that is a memory = game..you know the one with the cards that you have to pair up in order = to win, i have to use the graphic library of dev c++ in this game.=20 pls help me out with this project because me alone will not be able to = do it....i'm just a begginer. |
|
From: Daniel G. <sp...@ho...> - 2003-02-21 15:33:37
|
Try codeproject.com they had a great tutorial on calling a dll. >From: <dar...@vi...> >To: <dev...@li...> >Subject: [Dev-C++] calling functions from a DLL from your main program >Date: Thu, 20 Feb 2003 16:57:13 -0600 (CST) > >ok, so i made a C DLL in dev, and i have a C++ project. and since i cant >find no books on how to use DLLs inside your project, can someone please >tell me what to do? this is really getting to me. >the DLL is named >HTMLDll.dll >and i linked it by clicking on the "add library or object" feature and just >clicked on the DLL and it gave the whole path name. so i minimized it to a >relevant path name ie. instead of C:\WINDOWS\DESKTOP\Darks Briefcase\C++ >Programs\DarkCode\DarkCode\exten\HTMLDll.dll , i change it to >exten\HTMLDll.dll , was this a mistake, because i know with DLL files, you >have to take them everywhere the program goes, so a relevent pathname is >good right? > >anyways back to my original question, i have a simple messagebox function >in the HTMLDll just to test it, it compiled properly, we know this because >HTMLDll.dll was created. i have it linked and everything in DarkCode, but >what do i do to get that function from the DLL once a menu item is clicked, >case MI_DLLSHOW > >MI is my way of saying MenuItem, and when they click this button, the >messagebox the DLL provided is supposed to show up, but whats the command >for Dev C/C++? > >thank you for your time > > > > >------------------------------------------------------- >This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. >The most comprehensive and flexible code editor you can use. >Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. >www.slickedit.com/sourceforge >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Worried what your kids see online? Protect them better with MSN 8 http://join.msn.com/?page=features/parental&pgmarket=en-gb&XAPID=186&DI=1059 |
|
From: <cg...@wo...> - 2003-02-21 12:11:55
|
Do a search to gvd. Tulius Lima wrote: > Hello, > > > I would like to know whether is there a front-end to gdb, like > DDD, for windows? If so, can you please post the link? > > I've been trying to make DDD work on my windows machine, but so > far I have not suceeded. > > > TIA! > > Tulius Lima > > _________________________________________________________________ > MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. > The most comprehensive and flexible code editor you can use. > Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. > www.slickedit.com/sourceforge > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Colin L. <ha...@bl...> - 2003-02-21 08:55:57
|
Hello, > I would like to know whether is there a front-end to gdb, like DDD, > for windows? If so, can you please post the link? > I've been trying to make DDD work on my windows machine, but so far I > have not suceeded. If you still have Dev-C++ 4, you should try latest Dev-C++ 5 beta (http://bloodshed.net/dev/devcpp.html) which has an integrated debugger. Latest update 4.9.7.6 have been improved a lot in that area, you should give it a try :) Greetings, Colin > > TIA! > > Tulius Lima > > _________________________________________________________________ > MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. > The most comprehensive and flexible code editor you can use. > Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. > www.slickedit.com/sourceforge > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Frank W. <F.W...@wi...> - 2003-02-21 08:38:10
|
Hello, there is a graphical frontend for gdb and it's called insight. I use it on WinNT4.0 and Win98. Take a look at: http://sources.redhat.com/insight/ I think a binary file of insight is also available at bloodshed.net. Greetings Frank >>> "Tulius Lima" <tul...@ho...> 02/20 9:39 >>> Hello, I would like to know whether is there a front-end to gdb, like DDD, for windows? If so, can you please post the link? I've been trying to make DDD work on my windows machine, but so far I have not suceeded. TIA! Tulius Lima _________________________________________________________________ MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com ------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Faust, M. <Mar...@as...> - 2003-02-21 08:23:23
|
Hi, when compiling your code, i.e.
#include <iostream>
#include <stdlib.h>
#include <list>
using namespace std;
void f()
{
list<double> l;
for (int i=3D0; i<1000000;i++) l.push_back(i);
}
int main()
{
f();
system("PAUSE");
return 0;
}
I get the following errors:
std::_STL_mutex_lock::_M_acquire_lock()':
C:/Dev-Cpp/include/c++/bits/stl_threads.h:192: `_M_lock' undeclared (first
use
this function) In file included from C:/Dev-Cpp/include/c++/memory:55,
from C:/Dev-Cpp/include/c++/string:48,
from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
from C:/Dev-Cpp/include/c++/ios:48,
from C:/Dev-Cpp/include/c++/ostream:45,
from C:/Dev-Cpp/include/c++/iostream:45,
from test.cpp:1:
C:/Dev-Cpp/include/c++/bits/stl_alloc.h: At global scope:
C:/Dev-Cpp/include/c++/bits/stl_alloc.h:575: syntax error before `;' token
C:/Dev-Cpp/include/c++/bits/stl_alloc.h:575: confused by earlier errors,
bailing out make.exe: *** [test.o] Error 1 Execution terminated
What's wrong with my settings (Win2K, Dev-C++ 4.9.7.0)?
Markus
|