Click here to Skip to main content
15,888,454 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to undef a typedef? Pin
CPallini18-Oct-09 8:07
mveCPallini18-Oct-09 8:07 
AnswerOk, I'm a good sport, let's start from the beginning... Pin
Maximilien17-Oct-09 3:31
Maximilien17-Oct-09 3:31 
AnswerRe: how to undef a typedef? Pin
Bram van Kampen18-Oct-09 1:42
Bram van Kampen18-Oct-09 1:42 
Questionquestion about copy a picture with c [modified] Pin
Dengjin_CN16-Oct-09 23:16
Dengjin_CN16-Oct-09 23:16 
AnswerRe: question about copy a picture with c Pin
Rajesh R Subramanian17-Oct-09 0:35
professionalRajesh R Subramanian17-Oct-09 0:35 
GeneralRe: question about copy a picture with c Pin
Dengjin_CN17-Oct-09 1:25
Dengjin_CN17-Oct-09 1:25 
GeneralRe: question about copy a picture with c Pin
Richard MacCutchan17-Oct-09 3:58
mveRichard MacCutchan17-Oct-09 3:58 
AnswerRe: question about copy a picture with c Pin
Patcher3217-Oct-09 8:10
Patcher3217-Oct-09 8:10 
wb = open new binary file for writing, if file exists with same name, it will be truncated to 0 bytes
ab = open new binary file for writing, if file exists with same name, new data would be written at end of file. This may lead to undesired results if file already exists.

you should check if a file exists before opening it in wb mode :
#include<stdlib.h>

#include<stdio.h>
#define MAX 1024

int main(int argc,int **argv){
	
	FILE *fsource,*fdest;
	size_t in;
	int buf[MAX];
        char c = 'n';
	fsource = fopen("F:\\a.jpg.rar","rb");
        //-----------Check if file exists---------
        fdest = fopen("D:\\a.jpg","r");
        if(fdest!=NULL){
           fclose(fdest);
           printf("Destination file already exists, do you want to overwrite?\t");
           scanf("%c",&c);
           if(c!='Y' && c!='y'){
                fclose(fSource);
                return 1;
           }  
        }
        //---------------------------------------
	fdest = fopen("D:\\a.jpg","wb");
	if(fsource == NULL || fdest == NULL)
		perror("open error");
	
	while((in = fread(buf,sizeof(int),MAX,fsource)) != 0){
		fwrite(buf,sizeof(int),in,fdest);
		fflush(fdest);
	}
	
	fclose(fsource);
	fclose(fdest);
	
	return EXIT_SUCCESS;
}

Questionvs2005+WPCAP capture packets+callback function Pin
diaoxue16-Oct-09 20:04
diaoxue16-Oct-09 20:04 
QuestionVC6 installation error, what is this? Pin
includeh1016-Oct-09 13:39
includeh1016-Oct-09 13:39 
AnswerRe: VC6 installation error, what is this? Pin
«_Superman_»16-Oct-09 13:43
professional«_Superman_»16-Oct-09 13:43 
AnswerRe: VC6 installation error, what is this? Pin
Hans Dietrich16-Oct-09 13:46
mentorHans Dietrich16-Oct-09 13:46 
QuestionChanging the look and feel of a MFC dialog box Pin
burslem200116-Oct-09 12:15
burslem200116-Oct-09 12:15 
AnswerRe: Changing the look and feel of a MFC dialog box Pin
«_Superman_»16-Oct-09 13:24
professional«_Superman_»16-Oct-09 13:24 
GeneralRe: Changing the look and feel of a MFC dialog box Pin
burslem200116-Oct-09 18:06
burslem200116-Oct-09 18:06 
GeneralRe: Changing the look and feel of a MFC dialog box Pin
wangningyu16-Oct-09 20:32
wangningyu16-Oct-09 20:32 
GeneralRe: Changing the look and feel of a MFC dialog box Pin
burslem200119-Oct-09 1:28
burslem200119-Oct-09 1:28 
Questionmultithreading class [modified] Pin
es196816-Oct-09 11:25
es196816-Oct-09 11:25 
AnswerRe: multithreading class Pin
Moak17-Oct-09 1:27
Moak17-Oct-09 1:27 
GeneralRe: multithreading class Pin
es196817-Oct-09 2:04
es196817-Oct-09 2:04 
AnswerRe: multithreading class Pin
cmk17-Oct-09 4:22
cmk17-Oct-09 4:22 
GeneralRe: multithreading class Pin
es196817-Oct-09 6:16
es196817-Oct-09 6:16 
QuestionI just don't understand HWND Pin
GLGunblade16-Oct-09 8:24
GLGunblade16-Oct-09 8:24 
AnswerRe: I just don't understand HWND Pin
«_Superman_»16-Oct-09 8:44
professional«_Superman_»16-Oct-09 8:44 
GeneralRe: I just don't understand HWND Pin
GLGunblade16-Oct-09 8:52
GLGunblade16-Oct-09 8:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.