Hello chaitanya. That's much easier. That way, you just append to the file. Just make sure you put a '\n' character ONLY at the end of line. Today, you write a '\n' for each value, which gives a newline after each value. That's the reason why you get each value on a separate text line in the file. I don't know what function you are using for writing to the file today, but i suspect you are using fputc() or fputs(), right? There are numerous ways to write to a file, this is just one way. You can to this, using fputc. (I assume FILE * file): int number = '1'; fputc(number, file); fputc((int) ' ', file); number = '2'; fputc(number, file); fputc((int) ' ', file); number = '3'; fputc(number, file); fputc((int) ' ', file); And the last number: fputc(number, file); fputc((int) '\n', file); Or, if you got all numbers at the same time, you can do this: fprintf(file, "%d %d %d %d\n", 1,2,3,4); fprintf(file, "%d %d %d %d\n", 5,6,7,8); This is very basic knowledge, I think you should read a good beginners book about C and then go on with a book about C++. Good luck Kakan