Click here to Skip to main content
16,006,442 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Regarding Admin rights user Pin
Rajesh R Subramanian15-Oct-08 2:24
professionalRajesh R Subramanian15-Oct-08 2:24 
GeneralRe: Regarding Admin rights user Pin
H4u3215-Oct-08 3:22
H4u3215-Oct-08 3:22 
GeneralRe: Regarding Admin rights user Pin
Rajesh R Subramanian15-Oct-08 3:27
professionalRajesh R Subramanian15-Oct-08 3:27 
QuestionMaximizing and Minimizing main window in MDI application Pin
AnayKulkarni14-Oct-08 20:18
AnayKulkarni14-Oct-08 20:18 
AnswerRe: Maximizing and Minimizing main window in MDI application Pin
Naveen14-Oct-08 21:17
Naveen14-Oct-08 21:17 
GeneralRe: Maximizing and Minimizing main window in MDI application Pin
AnayKulkarni15-Oct-08 19:30
AnayKulkarni15-Oct-08 19:30 
AnswerRe: Maximizing and Minimizing main window in MDI application Pin
David Crow15-Oct-08 3:34
David Crow15-Oct-08 3:34 
QuestionCreatePipe is not working properly Pin
singh_nav14-Oct-08 19:28
singh_nav14-Oct-08 19:28 
Hi All,

My exceptions are to write and read data simultaneously.As data is written it should be read by another process.For this I am using the PIPE implementation.

I wrote the following code snippet for this but it is not working
Please let know where i am wrong

Thanks


HANDLE rHandle, wHandle ;
DWORD dw ;
DWORD dw1 ;

void WriteData(LPVOID)
{
char wBuff[512];

strcpy(wBuff, "HELLO world this program for reading the pipe\n ") ;

for( ; ; )
{
Sleep(1);
if(WriteFile(wHandle, wBuff, strlen(wBuff), &dw, NULL))
{
printf("Total %d byts written\n", dw);
}
else
{
printf("Could not write the buffer Last error:%d\n ", GetLastError());
break;
}
}
}

void ReadData(LPVOID)
{
char wBuff[512];
int i =0 ;

strcpy(wBuff, "HELLO world this program for reading the pipe\n ") ;

for( ; ; )
{
Sleep(1);
if(ReadFile(rHandle, wBuff, strlen(wBuff), &dw1, NULL))
{
printf("Total %d byts read\n", dw1 );
}
else
{
printf("Could not read the buffer Last error:%d\n ", GetLastError());
break;
}
}
}




void main()
{
HANDLE aThread;
DWORD ThreadID;
int i;


if(CreatePipe( &rHandle, &wHandle, NULL, 0))
{
CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) WriteData, NULL, 0, &ThreadID);

CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) ReadData, NULL, 0, &ThreadID);
}

}
AnswerRe: CreatePipe is not working properly Pin
_AnsHUMAN_ 14-Oct-08 19:41
_AnsHUMAN_ 14-Oct-08 19:41 
AnswerRe: CreatePipe is not working properly Pin
sashoalm14-Oct-08 21:41
sashoalm14-Oct-08 21:41 
GeneralRe: CreatePipe is not working properly Pin
singh_nav14-Oct-08 22:38
singh_nav14-Oct-08 22:38 
GeneralRe: CreatePipe is not working properly Pin
sashoalm14-Oct-08 23:03
sashoalm14-Oct-08 23:03 
GeneralRe: CreatePipe is not working properly Pin
singh_nav15-Oct-08 19:39
singh_nav15-Oct-08 19:39 
GeneralRe: CreatePipe is not working properly Pin
sashoalm15-Oct-08 22:16
sashoalm15-Oct-08 22:16 
GeneralRe: CreatePipe is not working properly Pin
singh_nav16-Oct-08 17:50
singh_nav16-Oct-08 17:50 
GeneralRe: CreatePipe is not working properly Pin
sashoalm17-Oct-08 2:36
sashoalm17-Oct-08 2:36 
QuestionRunning applications in Full Administrative priviledges in Windows Vista Pin
SNI14-Oct-08 19:17
SNI14-Oct-08 19:17 
AnswerRe: Running applications in Full Administrative priviledges in Windows Vista Pin
Mark Salsbery15-Oct-08 7:00
Mark Salsbery15-Oct-08 7:00 
GeneralRe: Running applications in Full Administrative priviledges in Windows Vista Pin
SNI16-Oct-08 1:21
SNI16-Oct-08 1:21 
QuestionRe: Running applications in Full Administrative priviledges in Windows Vista Pin
Mark Salsbery16-Oct-08 4:16
Mark Salsbery16-Oct-08 4:16 
AnswerRe: Running applications in Full Administrative priviledges in Windows Vista Pin
SNI16-Oct-08 18:26
SNI16-Oct-08 18:26 
GeneralRe: Running applications in Full Administrative priviledges in Windows Vista Pin
SNI20-Oct-08 19:06
SNI20-Oct-08 19:06 
QuestionCreate file and set size Pin
NewVC++14-Oct-08 19:03
NewVC++14-Oct-08 19:03 
AnswerRe: Create file and set size [modified] Pin
Hamid_RT14-Oct-08 19:28
Hamid_RT14-Oct-08 19:28 
GeneralRe: Create file and set size Pin
Naveen14-Oct-08 19:39
Naveen14-Oct-08 19:39 

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.