The editor should be able to create a new document and copy the contents of piped in data.
For example:
oh-my-posh config export | 10x
should open 10x, create a new file, and copy the output from the oh_my_posh command into the new document. This can be achieved using stdin.
Example:
In main()
#define MEGABYTE 0x100000
char* buffer = malloc(MEGABYTE);
memset(buffer, 0, MEGABYTE);
char in;
int index = 0;
while ((in = getc(stdin)) != EOF && index < MEGABYTE)
{
buffer[index++] = in;
}
buffer[index] = '\0';
printf("%s\n", buffer);
free(buffer);
Obviously, make the buffer a dynamically resizing array and do allocation checks, etc., etc., etc.
The editor should be able to create a new document and copy the contents of piped in data.
For example:
oh-my-posh config export | 10x
should open 10x, create a new file, and copy the output from the oh_my_posh command into the new document. This can be achieved using stdin.Example:
In main()
Obviously, make the buffer a dynamically resizing array and do allocation checks, etc., etc., etc.