2 ms·
If speed is important, why the copying of the data? Only 'slightly' non-portable: int main (int argc, const char * argv[]) { for( int i = 1; i < argc;
by Someone 15y ago
If speed is important, why the copying of the data? Only 'slightly' non-portable:
int main (int argc, const char * argv[])
{
for( int i = 1; i < argc; ++i)
{
((char *)argv[i])[-1] = ' ';
}
size_t len = strlen(argv[argc - 1]);
((char *)argv[argc - 1])[len] = '\n';
write(1, argv[1], argv[argc - 1] - argv[1] + len + 1);
return EXIT_SUCCESS;
}