c++ named pipe example

R

rajnish

Hi Gurus,

I am a newbee in C++ field. And I have been assigned to complete a
task of create a template class, so that names pipes can be created
using this template. I don't have a clue from where to start ...

I would be thankful if you could provide my any such template or
refernce to start.

Best regards,
 
L

Lionel B

rajnish said:
Hi Gurus,

I am a newbee in C++ field. And I have been assigned to complete a
task of create a template class, so that names pipes can be created
using this template. I don't have a clue from where to start ...

Named pipes are not part of the C++ language, so this question is
off-topic here. Suggest you try a unix newsgroup.
 
J

John Harrison

rajnish said:
Hi Gurus,

I am a newbee in C++ field. And I have been assigned to complete a
task of create a template class, so that names pipes can be created
using this template. I don't have a clue from where to start ...

I would suggest that you ask the person who made the assignment. This is not
an easy or obvious task and it is unfair to ask you to do it if you don't
have any clue.
I would be thankful if you could provide my any such template or
refernce to start.

The named pipe part is off topic in this group. C++ does not have named
pipes so if you need to know how to create named pipes you should ask on a
group that discusses programming on whatever operating system you are using.

But in general terms what you need to do is derive a new class from
basic_streambuf. Here is a link that discusses this
http://ou800doc.caldera.com/en/SDK_clib/_Deriving_New_streambuf_Classes.html.
However this discusses deriving from streambuf not basic_streambuf. The
differrence is that streambuf works on char only, but basic_streambuf is a
template where the type of character is the first template parameter. Since
you've been asked to write a template I guess that you need to derive from
basic_streambuf. But the principles are pretty similar in either case.

I have no idea of the quailty of the link above, it was just the first hit I
got with google.

john
 
J

John Harrison

Lionel B said:
Named pipes are not part of the C++ language, so this question is
off-topic here. Suggest you try a unix newsgroup.

I/O in general terms is certainly on topic here.

Named pipes also exist on Windows.

john
 
R

rajnish

John Harrison said:
I/O in general terms is certainly on topic here.

Named pipes also exist on Windows.

john

This template should be in c++ i.e. cross-platform (compiled using
gcc) ... was able to write simple c like code but not template ... I
wish if there could be any libaray with such a functionality :) ... I
think it is matter of time to learn templates ... only sorry thing is
time :( (which I am lacking at this moment)

Any help .. thanks in advance !!!
 
J

John Harrison

This template should be in c++ i.e. cross-platform (compiled using
gcc) ... was able to write simple c like code but not template ... I
wish if there could be any libaray with such a functionality :) ... I
think it is matter of time to learn templates ... only sorry thing is
time :( (which I am lacking at this moment)

It's not just templates that you have to learn, its the C++ I/O system. In
fact I wouldn't bother with a template at first. Just write your own stream
class, this means deriving classes from streambuf like I described earlier.
You can add in the template later, I think this will be the easier part of
the project.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top