Skip to content

Instantly share code, notes, and snippets.

@dce
Created September 20, 2012 18:38
Show Gist options
  • Select an option

  • Save dce/3757584 to your computer and use it in GitHub Desktop.

Select an option

Save dce/3757584 to your computer and use it in GitHub Desktop.

encode.c

Simple exercise for learning C:

  • Reads text from STDIN
  • By default, rotates all text by one character ("abc" => "bcd")
  • Prints to STDOUT
  • If the "-n [number]" flag is supplied, rotate by that many characters
  • If the "-d" (decode) flag is supplied, rotate in the opposite direction
  • If the "-f [filename]" flag is supplied, read from that file rather than STDIN
@reagent
Copy link
Copy Markdown

reagent commented Sep 22, 2012

What should the behavior be when supplying uppercase characters? Up to the implementer?

@dce
Copy link
Copy Markdown
Author

dce commented Sep 24, 2012

Yeah, I'd say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment