Binary file

Hi all
I have a C program to write it's output into a textfile which is also created by the program in between. The file that's get created prompt's a message while opening manually that the file is binary and any change in that leads to it's corruption.

I have used putc() to write the output to file.
I have also detected if i simply used the fopen() with file name (option "b" is not used) and then simply closed it using fclose() then a plaintext file get created which does not display above message.

The program is giving plain text file in windows which is expected.
How can i avoid the creation of binary file..?

Thanks in advance

What is the output from this command - assumes your file is called myfile.txt

/usr/bin/file myfile.txt

You may be writing non-ascii "junk" characters to your file.

If you do not want to create a binary file, then do not open or create using binary mode flag.