Turbo C, fopen(), fprintf() and ^Z - I need help!!

Graham Brand brand at janus.Berkeley.EDU
Tue Sep 18 16:53:46 AEST 1990


I should like some help with a simple problem in Turbo C. I have a
C program which I have been running on UNIX with no problem. I am
trying to port it to Turbo C 2.0 running on my '386 under MSDOS (V3.3)
but am having a strange problem. The program opens files for appending
data using the:
	fopen(fp,filename,"a")
construction and writes the data with the usual
	fprintf(fp,"%s ...%d\n",.....)
instruction. The problem that I am having is that the line that is 
appended in the file is preceeded with a ^Z which makes the data
invisible when a type command is issued from MSDOS. I can use vi and
edit the file to remove the ^Z but don't want to have to do that every 
time. Can someone explain what is going on and propose a fix?

Thanks in advance,
Graham Brand (brand at janus.berkeley.edu)



More information about the Comp.lang.c mailing list