dev-cpp-users Mailing List for Dev-C++
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
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
(6) |
2
(1) |
3
(18) |
4
(10) |
5
(3) |
6
(6) |
7
(2) |
|
8
(2) |
9
(2) |
10
(3) |
11
(4) |
12
(6) |
13
(3) |
14
(1) |
|
15
|
16
(2) |
17
(11) |
18
(6) |
19
(4) |
20
(11) |
21
(14) |
|
22
(12) |
23
(9) |
24
(5) |
25
(3) |
26
(1) |
27
(4) |
28
(3) |
|
29
(7) |
30
(24) |
31
(12) |
|
|
|
|
|
From: Jeethu R. <je...@sa...> - 2001-07-02 03:47:00
|
Hi,
I'm writing a small program for which, I use fwrite to write the output to a
binary file. But I can write with it successfully, but the last member of
the structure is not written. What could be the problem ? here is a brief
snippet
of the fwrite section.
Thanks Johannes Pretorius for your last suggestion regarding seperating
filename and pathnames. Although
Johanne's code did'nt work, he gave me a brief Idea of how it could be done.
the code is given below the first snip.
Although its quite long, it meets its design consderation(Safety!).
Johannes, you may not like the malloc() i too
don't like it but it seems to be ok out there.
Thnx,
Jeethu Rao
<Snippet>
struct tea_hdr
{
char jte[3];
unsigned char version;
DWORD infile_size;
DWORD infile_crc;
unsigned char fname_sz;
};
tea_hdr header;
strncpy((char*)header.jte,"JTE",3);
header.version = 1;
header.infile_size = (DWORD)fil_len;
header.infile_crc = crc32;
header.fname_sz =(unsigned char)strlen(filename);
if(strlen(filename)>255)
{
fclose(outfile);
Terror=err_fname_too_long;
return Terror;
}
if((fwrite(&header,sizeof(header),1,outfile))!=1) //This writes everything
except fname_sz
{
cout<<"Error Here"<<endl;
fclose(outfile);
Terror=err_opt_file;
return Terror;
}
</Snippet>
int TEA::encipher_file(char* filename,char* outfilename,unsigned long*
password )
{
FILE* infile;
FILE* outfile;
err_msgs Terror;
if((infile = fopen(filename,"rb"))==NULL)
{
Terror = err_no_input_file;
return Terror;
}
fclose(infile); // Just for a while
if((outfile = fopen(outfilename,"wb"))==NULL)
{
fclose(infile);
Terror = err_opt_file;
return Terror;
}
//Now that the Bad Guys are taken care of, lets Continue the Good Work
DWORD crc32;
long crc_len;
long fil_len;
int crc_result;
crc_result = crc32file(filename,&crc32,&crc_len);
fil_len=flength(filename);
if(fil_len ==-1)
{
fclose(outfile);
Terror = err_no_input_file;
return Terror;
}
if(crc_result==-1)
{
fclose(outfile);
Terror = err_calc_crc;
return Terror;
}
struct tea_hdr
{
char jte[3];
unsigned char version;
DWORD infile_size;
DWORD infile_crc;
unsigned char fname_sz;
};
tea_hdr header;
strncpy((char*)header.jte,"JTE",3);
header.version = 1;
header.infile_size = (DWORD)fil_len;
header.infile_crc = crc32;
header.fname_sz =(unsigned char)strlen(filename);
cout<<"sizeof(header) = "<< sizeof(header)<<endl;
printf("header.jte = %s3\n",header.jte);
printf("header.version = %i\n",header.version);
printf("header.infile_size = %u\n",header.infile_size);
printf("header.infile_crc = %u\n",header.infile_crc);
printf("header.fname_sz = %d\n",header.fname_sz);
if(strlen(filename)>255)
{
fclose(outfile);
Terror=err_fname_too_long;
return Terror;
}
if((fwrite(&header,sizeof(header),1,outfile))!=1)
{
cout<<"Error Here"<<endl;
fclose(outfile);
Terror=err_opt_file;
return Terror;
}
if(fwrite(filename,strlen(filename),1,outfile)!=1)
{
fclose(outfile);
Terror=err_opt_file;
return Terror;
}
long infilebuf_sz = fil_len+(fil_len%8);
char* infilebuf =(char*)malloc(infilebuf_sz);
char inbuf[8];
char outbuf[8];
if(infilebuf==NULL)
{
fclose(outfile);
Terror=err_no_mem;
return Terror;
}
infile = fopen(filename,"rb");
memset(infilebuf,'\0',infilebuf_sz);
if(fread(infilebuf,fil_len,1,infile)!=1)
{
free(infilebuf);
fclose(infile);
fclose(outfile);
Terror=err_input_file;
return Terror;
}
for(int x=0;x<infilebuf_sz;x+=8) // might be <= ?
{
strncpy(inbuf,infilebuf+x,8);
encipher((unsigned long*)inbuf,(unsigned long*)outbuf,password);
if(fwrite((char*)&outbuf,8,1,outfile)!=1)
{
Terror=err_opt_file;
return Terror;
}
}
free(infilebuf);
fclose(infile);
fclose(outfile);
return 0;
}
char* TEA::err2msg(int err)
{
//errmsg loctemp;
//loctemp = err;
switch(err)
{
case err_ok:
return "No Error Encountered\n";
break;
case err_no_input_file:
return "Input File Does Not Exist\n";
break;
case err_no_output_file:
return "Output File Already Exists\n";
break;
case err_opt_file:
return "Error while writing Output File\n";
break;
case err_input_file:
return "Error while reading input file\n";
break;
case err_calc_crc:
return "Error while calculating CRC32\n";
break;
case err_fname_too_long:
return "Error: The input filename is greater that 255 characters\n";
break;
case err_no_mem:
return "Error: Not enough memory\n";
break;
}
}
<SNIPPET>
//The working code for seperating filenames and pathnames
BOOL getFileName(char *SourceString,char *cpFileDir, char *cpFileName)
{
int iPos = 0;
char *cpCutOffPoint;
char *caSourceString = (char*)malloc(strlen(SourceString)+1);
if(caSourceString==NULL)
{
return FALSE;
}
if(strlen(SourceString)==0)
{
free(caSourceString);
return FALSE;
}
strcpy(caSourceString,SourceString);
strrev(caSourceString);
cpCutOffPoint = strchr(caSourceString,'\\');
if(cpCutOffPoint==NULL)
{
strcpy(cpFileName,caSourceString);
strrev(cpFileName);
free(caSourceString);
return TRUE;
}
strcpy(cpFileDir,cpCutOffPoint);
strrev(cpFileDir);
iPos = strlen(caSourceString)-strlen(cpFileDir);
strncpy(cpFileName,caSourceString,iPos);
cpFileName[iPos]='\0';
strrev(cpFileName);
free(caSourceString);
return TRUE;
}
</SNIPPET>
|