Загрузка данных


#define _POSIX_C_SOURCE 200809L
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    char *end;
    long cnt, idx;

    if (argc != 2)
    {
        return 1;
    }
    errno = 0;
    cnt = strtol(argv[1], &end, 10);
    if (errno != 0 || *end != '\0' || cnt < 0)
    {
        return 1;
    }
    for (idx = 0; idx < cnt; idx++)
    {
        printf("%ld\n", (long)getpid());
    }
    exit(0);
}