[Github-comments] [geany/geany] [Feature request] Support different combinations of I/O in Custom Commands (#1037)

Andy Alt notifications at xxxxx
Thu Oct 20 20:19:19 UTC 2016


@b4n Thanks for reminding me about `stdin`, I read the docs but must have spaced it.

This capped only the first letter of the selection of course, but it worked. I'll just have to add a couple lines to make it cap the first letter of each word. Thanks!
```
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(int argc, char **argv)
{
  char word[80];

  if (fgets (word, sizeof (word), stdin) != NULL)
  {
    word[0] = toupper (word[0]);
    fprintf (stdout, "%s ", word);
    return 0;
  }

  return 1;
}
```
> BTW, if you got Python installed, you could simply do: python3 -c 'from sys import stdin, stdout; stdout.write(stdin.read().title())' (I recommend using Python 3.x that doesn't need extra care to properly handle Unicode input here)

I don't know much python. You're saying I could accomplish what I want just using the code you provided?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1037#issuecomment-255216415
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20161020/21391c49/attachment.html>


More information about the Github-comments mailing list