Use this:

g++ -o blimpo blimpo.cpp
#include <iostream>
#include <cstdlib>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

namespace
{

    string                              g_argv0;

    void usage(string const & msg)
    {
        if (!msg.empty())
            cerr << msg << endl;
        cerr << "usage : " << g_argv0 << " <size>[kKmMgG]" << endl;
        cerr << "  k=1000, K=1024, m=1e6, M=2^20, g=1e9, G=2^30" << endl;

        exit(1);
    }
}

int
main(int argc, char ** argv)
{
    g_argv0 = argv[0];

    if (argc != 2)
        usage("missing <size><unit> argument");


    istringstream istrm(argv[1]);
    double sz;
    char unit;
    if (!(istrm >> sz >> unit))
        usage("error parsing size/unit, try \"50M\"");

    switch (unit)
    {
    case 'k':
        sz *= 1000.0;
        break;

    case 'K':
        sz *= 1024.0;
        break;

    case 'm':
        sz *= 1000.0 * 1000.0;
        break;

    case 'M':
        sz *= 1024.0 * 1024.0;
        break;

    case 'g':
        sz *= 1000.0 * 1000.0 * 1000.0;
        break;

    case 'G':
        sz *= 1024.0 * 1024.0 * 1024.0;
        break;
    }

    size_t isz = size_t(sz);

    vector<unsigned char> buffer;
    buffer.resize(isz);

    while (true)
    {
        for (size_t i = 0; i < isz; i += 1024)
            buffer[i] = 0;
        cerr << ".";
    }
}