1) How can i put a new line when i write two record? For example, if i put two "fsalida.write" in the program, it not generates two records, it puts one continuos to other. I tried with "\n" but does not work well.
2) The char buffer for "TER" has 273 characters, but i need only 272 (B count). If i use only 272 in char buffer, the program crash.
3) When in open with notepad++ the file, i see binary characters at the end of the record. I spected see the record finish with B.
1) > it not generates two records, it puts one continuos to other.
¿and that's a problem because...? You know the size of the register, so you know exactly where each one starts and ends.
2) You forgot the '\0'. strcpy() will put it automatically, you may use memcpy() instead.
3) Probably padding. You object is bigger than necessary in order to optimize tasks.
Or a bug with that editor, you should use an `hex' viewer when dealing with binary files.
If you're trying to produce a file in a specified format (241 character string, 8 64-bit numbers, 272-character string, endline), that's exactly what you should do. Your program produces a file that contains the binary representations of struct objects, which is not the same thing.
if you'd like to keep it in a struct, you could give it its own operator>>, and use that: