Click here to Skip to main content
15,886,422 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionPlay Two video file in different left right speaker Pin
Shivanand Gupta27-Nov-09 18:54
Shivanand Gupta27-Nov-09 18:54 
AnswerRe: Play Two video file in different left right speaker Pin
Richard MacCutchan27-Nov-09 21:45
mveRichard MacCutchan27-Nov-09 21:45 
AnswerRe: Play Two video file in different left right speaker Pin
Rozis28-Nov-09 4:22
Rozis28-Nov-09 4:22 
QuestionConverting different data types from a class template. Pin
Member 382253227-Nov-09 15:10
Member 382253227-Nov-09 15:10 
AnswerRe: Converting different data types from a class template. Pin
«_Superman_»27-Nov-09 17:19
professional«_Superman_»27-Nov-09 17:19 
QuestionOpen-With menu items for given file extension Pin
michalJ27-Nov-09 13:25
michalJ27-Nov-09 13:25 
AnswerRe: Open-With menu items for given file extension Pin
Rozis28-Nov-09 4:25
Rozis28-Nov-09 4:25 
QuestionUploading a file using CHttpFile Pin
msn9227-Nov-09 12:17
msn9227-Nov-09 12:17 
Hi
I'm uploading a file using CInternetSession, CHttpConnection and CHttpFile.
The program is working properly. However, I have some questions:


1. Does the program send data each time CHttpFile::Write() called? Or are all data sent when CHttpFile::EndRequest() called?
2. How big should the buffer size be(while reading from local file and writing to CHttpFile)?[Please see the source code below]
3. Does using Keep-alive connection(INTERNET_FLAG_KEEP_CONNECTION) help in any way?[Please see the source code below]

CInternetSession ises = NULL;
CHttpFile* httpf = NULL;
CHttpConnection *connection = NULL;

file=new CFile(L"file2upload.txt",CFile::modeRead);

connection = ises.GetHttpConnection(L"myserver.com");

http = connection->OpenRequest(CHttpConnection::HTTP_VERB_POST, L"upload.php",0,1,0,0,INTERNET_FLAG_KEEP_CONNECTION);

CString hdrs /* = My appropriate headers to send */;
httpf->AddRequestHeaders(hdrs);

PreFileData /* = prefile data */;
PostFileData /* = postfile data */;

httpf->SendRequestEx(DWORD(PreFileData.GetLength()+file->GetLength()+PostFileData.GetLength()), HSR_SYNC | HSR_INITIATE);

httpf->Write((LPSTR)(LPCSTR)PreFileData, PreFileData.GetLength());

UINT len=1024;
char buf[1024]; /*BUFFER SIZE = 1024 HOW BIG ACTUALLY SHOULD IT BE?*/
while(len>0){
	len=f->Read(&buf,1024);
	if(len>0)httpf->Write(&buf,len);
}

httpf->Write((LPSTR)(LPCSTR)PostFileData, PostFileData.GetLength());

httpf->EndRequest(HSR_SYNC);

file->Close();
httpf->Close();
connection->Close();


Thanks in advance
QuestionThread handle from thread ID [solved] Pin
PJ Arends27-Nov-09 10:40
professionalPJ Arends27-Nov-09 10:40 
AnswerRe: Thread handle from thread ID Pin
Garth J Lancaster27-Nov-09 11:28
professionalGarth J Lancaster27-Nov-09 11:28 
GeneralRe: Thread handle from thread ID Pin
PJ Arends27-Nov-09 17:01
professionalPJ Arends27-Nov-09 17:01 
Questionplease help : how to draw BSpline by using mouse ??? Pin
a04.lqd27-Nov-09 6:59
a04.lqd27-Nov-09 6:59 
AnswerRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 7:14
mveRichard MacCutchan27-Nov-09 7:14 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
a04.lqd27-Nov-09 7:19
a04.lqd27-Nov-09 7:19 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 7:27
mveRichard MacCutchan27-Nov-09 7:27 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Cedric Moonen27-Nov-09 7:28
Cedric Moonen27-Nov-09 7:28 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
CPallini27-Nov-09 7:26
mveCPallini27-Nov-09 7:26 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 7:28
mveRichard MacCutchan27-Nov-09 7:28 
AnswerRe: please help : how to draw BSpline by using mouse ??? Pin
«_Superman_»27-Nov-09 9:15
professional«_Superman_»27-Nov-09 9:15 
QuestionQuestion about double #INF and #NAN Pin
Jeff Archer27-Nov-09 5:02
Jeff Archer27-Nov-09 5:02 
QuestionRe: Question about double #INF and #NAN Pin
CPallini27-Nov-09 5:54
mveCPallini27-Nov-09 5:54 
AnswerRe: Question about double #INF and #NAN Pin
Jeff Archer27-Nov-09 7:08
Jeff Archer27-Nov-09 7:08 
GeneralRe: Question about double #INF and #NAN Pin
Richard MacCutchan27-Nov-09 7:17
mveRichard MacCutchan27-Nov-09 7:17 
GeneralRe: Question about double #INF and #NAN Pin
Jeff Archer27-Nov-09 7:51
Jeff Archer27-Nov-09 7:51 
GeneralRe: Question about double #INF and #NAN Pin
CPallini27-Nov-09 7:23
mveCPallini27-Nov-09 7:23 

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.