Click here to Skip to main content
15,885,365 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow can i get psapi.h file Pin
trinadh_t5-Jan-06 0:01
trinadh_t5-Jan-06 0:01 
AnswerRe: How can i get psapi.h file Pin
benjymous5-Jan-06 0:15
benjymous5-Jan-06 0:15 
AnswerRe: How can i get psapi.h file Pin
Owner drawn5-Jan-06 0:21
Owner drawn5-Jan-06 0:21 
GeneralRe: How can i get psapi.h file Pin
vikas amin5-Jan-06 1:06
vikas amin5-Jan-06 1:06 
GeneralRe: How can i get psapi.h file Pin
Prakash Nadar5-Jan-06 1:12
Prakash Nadar5-Jan-06 1:12 
GeneralRe: How can i get psapi.h file Pin
vikas amin5-Jan-06 2:13
vikas amin5-Jan-06 2:13 
GeneralRe: How can i get psapi.h file Pin
ThatsAlok8-Jan-06 20:58
ThatsAlok8-Jan-06 20:58 
Questionplz help Pin
thes3cr3t14-Jan-06 23:16
thes3cr3t14-Jan-06 23:16 
Hi there, Iv wrote a program to transfer files between a cleint and a server,the code works fine for small files but not for large files,im going to post the code wich i hope will help other people trying to do something similar and in hope that i can get some suggestions on how to improve the code iv wrote.


{
char *buffer;
char sizebuf[20] = "";
long SizeOfFile = 1;
long BytesSent = 0;

std::ifstream file ("C:\\Windows\\Example.exe" std::ios::in | std::ios::binary | std::ios::ate);
if (!file)
{
MessageBox(NULL,"Error Opening File",NULL,MB_OK);
}
SizeOfFile = file.tellg(); //get size of file
file.seekg (0, std::ios::beg);
ltoa(SizeOfFile,sizebuf,10); //put sizeoffile in char buf
send(newsock,sizebuf,strlen(sizebuf),0);//send the size to client
buffer = new char[SizeOfFile];
file.read (buffer,SizeOfFile).eof();
do{
BytesSent = send(newsock,buffer,SizeOfFile,0);
}while(BytesSent < SizeOfFile);


Here i dont know if i should be reading blocks of the file into the buffer in the do while loop or out side of the loop and i dont know how to equally divide the file into "Chunks" to be sent separatly and rebuilt the other side help would be appriciated



{
char buffer[20];
long SizeOfFile = 0;
char* recvfilebuf;

recv(Socket,buffer,sizeof(buffer),0); //recv size of file to be d/l
SizeOfFile = atol(buffer);
ZeroMemory(buffer,20);

recvfileBuf = new char[SizeOfFile];
std::fstream file (C:\\Example.exe, std::ios::out | std::ios::binary | std::ios::ate); //Dir of our new .exe
if (!file)
{
MessageBox(NULL,"Error Opening File",MB_OK);
}

do
{
recieved = recv(Socket,recvfileBuf,SizeOfFile,0); //recv actuall file
file.write(recvfileBuf,recieved).eof(); //write new file

}while(recieved < SizeOfFile);
ZeroMemory(buffer,20);
}

I know there is a better way of doing what im trying to do but its hard without extensive know how on the subject..Any comments would be greatly apriciated

Thankyou
AnswerRe: plz help Pin
David Crow5-Jan-06 3:00
David Crow5-Jan-06 3:00 
AnswerRe: plz help Pin
John R. Shaw5-Jan-06 12:34
John R. Shaw5-Jan-06 12:34 
QuestionStop Dos box appearing on screen Pin
KevinSheedy4-Jan-06 23:02
KevinSheedy4-Jan-06 23:02 
AnswerRe: Stop Dos box appearing on screen Pin
Owner drawn4-Jan-06 23:07
Owner drawn4-Jan-06 23:07 
QuestionCDHtmlDialog (COM?): memory leak, wrong 'this' pointer, ect Pin
balage24-Jan-06 22:44
balage24-Jan-06 22:44 
QuestionI want to print using the CView Pin
vikas amin4-Jan-06 22:34
vikas amin4-Jan-06 22:34 
AnswerRe: I want to print using the CView Pin
Zdeslav Vojkovic4-Jan-06 22:52
Zdeslav Vojkovic4-Jan-06 22:52 
GeneralRe: I want to print using the CView Pin
vikas amin6-Jan-06 2:22
vikas amin6-Jan-06 2:22 
QuestionRun a Batch or .exe file from a program Pin
KevinSheedy4-Jan-06 22:10
KevinSheedy4-Jan-06 22:10 
AnswerRe: Run a Batch or .exe file from a program Pin
Owner drawn4-Jan-06 22:17
Owner drawn4-Jan-06 22:17 
AnswerRe: Run a Batch or .exe file from a program Pin
S Douglas5-Jan-06 1:05
professionalS Douglas5-Jan-06 1:05 
AnswerRe: Run a Batch or .exe file from a program Pin
ThatsAlok8-Jan-06 23:00
ThatsAlok8-Jan-06 23:00 
QuestionAccessing Windows Clock Pin
KevinSheedy4-Jan-06 22:04
KevinSheedy4-Jan-06 22:04 
AnswerRe: Accessing Windows Clock Pin
Owner drawn4-Jan-06 22:06
Owner drawn4-Jan-06 22:06 
GeneralRe: Accessing Windows Clock Pin
Anilkumar K V5-Jan-06 0:39
Anilkumar K V5-Jan-06 0:39 
AnswerRe: Accessing Windows Clock Pin
Prakash Nadar4-Jan-06 23:49
Prakash Nadar4-Jan-06 23:49 
AnswerRe: Accessing Windows Clock Pin
ThatsAlok8-Jan-06 20:55
ThatsAlok8-Jan-06 20:55 

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.