So, just create yourself a new partition, say "hda7", by shrinking one of the others slightly (just a couple of blocks is plenty).

Now you can write C code to access it as if it were a file, as in:

fd = open("/dev/hda7", O_RDWR);
read(fd, buf, sizeof(buf));
...
write(fd, buf, sizeof(buf));
close(fd);

and just treat it like any other file. The only difference is that the size will remain constant == the partition size.

Simple, eh?