I know their are some in C so shouldn't their be some in C++?

Recommended Answers

All 8 Replies

It's based on C, so I believe the answer is absolutely and the same.... perhaps someone will have more to add to this...

It's based on C, so I believe the answer is absolutely and the same.... perhaps someone will have more to add to this...

If you can do it in C, you can almost certainly do it in C++. In a handful of rare cases, this not being one of them, you might have to change the syntax here and there. Just do what you do in C and stick it in a C++ program and chances are it will compile as-is. The compiler will yell at you if you use C++ keywords, stuff like that.

If you're worried, read these links.

http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B
http://david.tribble.com/text/cdiffs.htm

I don't see anything about piping in them and I've done it successfully in both languages. The answer is definitely yes. You can use pipes in C++.

so use the same commands as in C?

pipes are a POSIX API (and not a language issue at all).

If you've got an appropriate declaration, then you can call them from whatever language you like (perl and python can access pipes as well).

Basically my assignment says. Write a program to read a series of names, one per line, from standard input and write out those names spelled in reverse order to standard output. Use I/O redirection and pipes to do the following:

a) Input a series of names that are typed in from keyboard, and write them out, reversed to file1.
b)Read the names in from file1; then write them out,re-reversed, to a file called file2.
c) Read the names in from file2, reverse them again, and then sort the resulting list of reversed words using sort.

So doesn't this imply that i must have unix. Which i don't so how am i supposed to do this?

so i am assuming i am supposed to do what unix pipe commands do in C++?

thanks. Have no idea what he wanted. apparently you can link two programs together in ms-dos and achieve this. Atleast that's what i think he wanted us to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.