Click here to Skip to main content
15,914,225 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralConsole Window in VC Managed Extension samples Pin
Liaqat Fayyaz16-Oct-03 20:40
Liaqat Fayyaz16-Oct-03 20:40 
GeneralRe: Console Window in VC Managed Extension samples Pin
Anonymous16-Oct-03 22:40
Anonymous16-Oct-03 22:40 
GeneralRe: Console Window in VC Managed Extension samples Pin
Mike Dimmick16-Oct-03 22:40
Mike Dimmick16-Oct-03 22:40 
Generalabt view in html Pin
SatyaDY16-Oct-03 20:10
SatyaDY16-Oct-03 20:10 
GeneralInternational Password Encryption Pin
skallestad16-Oct-03 18:00
skallestad16-Oct-03 18:00 
GeneralRe: International Password Encryption Pin
Johnny ²17-Oct-03 8:33
Johnny ²17-Oct-03 8:33 
Generaldll/ActiveX issue Pin
work_to_live16-Oct-03 17:36
work_to_live16-Oct-03 17:36 
QuestionWhat is an Illegal Seek and what can I do? Pin
elchip16-Oct-03 15:37
elchip16-Oct-03 15:37 
I'm having some problems with interprocess communication. Here's the essentials of my code. I create two FIFOs, do some read/write, and close them. All goes well until after the reading/writing; when I close the FIFOs, I start getting "Illegal seek" errors, and finally a segmentation fault. I've attached the parent / child code, and the output. The perror statements were in there for debugging purposes, but I left them in so you can see where the "Illegal seeks" start. Any idea what I've done wrong?

(rbuf and wbuf are char *'s, and these processes are created with a standard fork() call)

PARENT
Mkfifo(syscallFifo,S_IRUSR | S_IWUSR);
fdsys = Open(syscallFifo,O_RDONLY);
Read(fdsys,&irbuf,sizeof(int));
printf("The child said: %d\n",irbuf);
Read(fdsys,&*rbuf,irbuf);
printf("The child said: %s\n",rbuf);
fdrep = Open(replyFifo,O_WRONLY);
wbuf = "Hello from the parent";
iwbuf = strlen((const char *)wbuf) + 1;
Write(fdrep,&iwbuf,sizeof(int));
Write(fdrep,&*wbuf,iwbuf);
perror("Waiting for the child to end");
wait(&status);
perror("All done waiting");
Close(fdsys);
perror("Parent closed first fifo");
Close(fdrep);
perror("Parent closed second fifo");
Unlink(syscallFifo);
Unlink(replyFifo);

CHILD
Mkfifo(replyFifo,S_IRUSR | S_IWUSR);
fdsys = Open(syscallFifo,O_WRONLY);
wbuf = "Hello from the child";
iwbuf = strlen((const char *)wbuf) + 1;
Write(fdsys,&iwbuf,sizeof(int));
Write(fdsys,&*wbuf,iwbuf);
fdrep = Open(replyFifo,O_RDONLY);
Read(fdrep,&irbuf,sizeof(int));
printf("The parent said: %d\n",irbuf);
Read(fdrep,&*rbuf,irbuf);
printf("The parent said: %s\n",rbuf);
perror("Time for the child to shush");
Close(fdsys);
perror("Child closed first fifo");
Close(fdrep);
perror("Child closed second fifo");
exit(0);

OUTPUT
The child said: 21
The child said: Hello from the child
Waiting for the child to end: Success
The parent said: 22
The parent said: Hello from the parent
Time for the child to shush: Success
Child closed first fifo: Illegal seek
Child closed second fifo: Illegal seek
All done waiting: Illegal seek
Parent closed first fifo: Illegal seek
Parent closed second fifo: Illegal seek
Segmentation fault
AnswerRe: What is an Illegal Seek and what can I do? Pin
Johnny ²16-Oct-03 21:39
Johnny ²16-Oct-03 21:39 
GeneralRe: What is an Illegal Seek and what can I do? Pin
elchip17-Oct-03 1:58
elchip17-Oct-03 1:58 
AnswerRe: What is an Illegal Seek and what can I do? Pin
Steve S17-Oct-03 1:53
Steve S17-Oct-03 1:53 
QuestionBest way to implement keyboard shortcuts? Pin
IGx8916-Oct-03 14:19
IGx8916-Oct-03 14:19 
Questionextending intellisense in VS 6.0 ? Pin
vark16-Oct-03 13:11
vark16-Oct-03 13:11 
AnswerRe: extending intellisense in VS 6.0 ? Pin
Mike Dimmick16-Oct-03 22:42
Mike Dimmick16-Oct-03 22:42 
Questionhow can i open and read PS/2 port ? Pin
asd175316-Oct-03 11:32
asd175316-Oct-03 11:32 
Questionhow can i open and read PS/2 port ? Pin
16-Oct-03 11:32
suss16-Oct-03 11:32 
Generalquick cmd prompt question Pin
keegan16-Oct-03 10:42
keegan16-Oct-03 10:42 
GeneralRe: quick cmd prompt question Pin
Ranjan Banerji16-Oct-03 11:05
Ranjan Banerji16-Oct-03 11:05 
GeneralRe: quick cmd prompt question Pin
keegan16-Oct-03 11:09
keegan16-Oct-03 11:09 
GeneralRe: quick cmd prompt question Pin
Randhir Sinha16-Oct-03 19:52
Randhir Sinha16-Oct-03 19:52 
GeneralRe: quick cmd prompt question Pin
Steve S17-Oct-03 1:56
Steve S17-Oct-03 1:56 
GeneralRe: quick cmd prompt question Pin
Anonymous16-Oct-03 17:01
Anonymous16-Oct-03 17:01 
GeneralRe: quick cmd prompt question Pin
keegan17-Oct-03 8:01
keegan17-Oct-03 8:01 
GeneralOnShowWindow called twice Pin
MarcoNedwig16-Oct-03 9:33
MarcoNedwig16-Oct-03 9:33 
GeneralInitDialog Visual Studio .Net2003 Pin
MarcoNedwig16-Oct-03 9:30
MarcoNedwig16-Oct-03 9:30 

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.