// outRaw_lines.cpp - creating a number of black lines
#include <iostream>
#include <fstream>

int main() {
  using namespace std;
  char filename[20];
  unsigned char val = 0; 
  
  cout << "Enter a filename (e.g. pic.raw):";
  cin >> filename;
  
  // a condensed way of creating a ofstream object and 
  // assigning a file at the same time. 
  ofstream fout(filename);
  
  // using modulo to create a black pixel every odd pixel.
  // ends up with alternating white and black lines.
  for(int i=0;i<400;i++) {
    if (i%2==0) val = 255;
    else val =0;
    fout << val;
  }

  fout.close();

}
