0

I have this question from my programming class, we are programming in C++ and I'm not sure what the <> and & mean and are referring to, the question is:

process < grass > milk &

For the above commands to work as intended, what kind of files are process, grass and milk?

Mat
  • 202,337
  • 40
  • 393
  • 406
  • 1
    You should get [a good book](http://stackoverflow.com/q/388242/2513200) - this kind of things should be covered by any reasonable C++ beginners book. The keywords to look for are "templates" and "references". – Hulk Nov 22 '13 at 15:04
  • Did the question ask what kind of *files* they were? – doctorlove Nov 22 '13 at 15:07
  • 3
    Is this something to be entered on a *command line*? With file redirection and `&` to run in the background? Or is this some kind of `C++` *code*? If it is the first option, this has nothing at all to do with `C++`, just basic file redirection using a command line program. – crashmstr Nov 22 '13 at 15:10
  • Oh, didn't even think of that - might actually be the case. – Hulk Nov 22 '13 at 15:11
  • @crashmstr That might be it. Of course, that would make `process` describe the (simplified) workings of a cow. – Angew is no longer proud of SO Nov 22 '13 at 15:12

2 Answers2

4

Assuming this is a command line to be entered on a Linux system,

  • process is a program or script file that can be executed.
  • grass is an existing text file whose contents are redirected to the standard input of process
  • after process finishes, milk is a text file that contains the redirected standard output of process
  • & tells the shell to run process in the background.

But, this has nothing to do with C++ code.

crashmstr
  • 28,043
  • 9
  • 61
  • 79
  • Hey yeah i think this is _bash_ file redirection not _templates_ in c++! [this link](http://www.tldp.org/LDP/abs/html/io-redirection.html) might be a good one for him – James Nov 22 '13 at 15:32
  • The teacher didn't specify whether it was C++ code or linux command line input- I assumed it was C++ code because that was what the other questions were asking, but this makes sense, thanks! – user3022181 Nov 24 '13 at 21:58
0

It is a reference (&) to an instance of the class process using as template grass.

You should study at least classes, references, and templates.

Claudio
  • 10,614
  • 4
  • 31
  • 71
  • 1
    The question says what kind of *files* are they. Which makes no sense to me. – doctorlove Nov 22 '13 at 15:06
  • You might like to read more about [_files_ here.](http://en.wikipedia.org/wiki/Computer_file) _"On most modern operating systems, files are organized into one-dimensional arrays of bytes. The format of a file is defined by its content since a file is solely a container for data"_ I know a lot of this stuff seems obvious but it might help to think about it like _container for data_ rather than _file_. – James Nov 22 '13 at 15:23
  • @g-makulik When doctorlove wrote _"The question says what kind of files are they. Which makes no sense to me"_ People where looking at this like a c++ question which wouldn't make sense it's talking about a literal **file** – James Nov 22 '13 at 16:21
  • @g-makulik I realize that now :/ – James Nov 22 '13 at 16:26