www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/11/07:05:29

Message-ID: <37375A59.39A0@ns.sympatico.ca>
From: Klaas <klaas AT ns DOT sympatico DOT ca>
X-Mailer: Mozilla 3.04 (Win95; I)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Need Help with writing to disk files!
References: <37374DD2 DOT B532713C AT sginet DOT com>
Lines: 25
Date: Mon, 10 May 1999 19:14:49 -0300
NNTP-Posting-Host: 142.177.71.1
X-Trace: sapphire.mtt.net 926374800 142.177.71.1 (Mon, 10 May 1999 19:20:00 ADT)
NNTP-Posting-Date: Mon, 10 May 1999 19:20:00 ADT
Organization: Sympatico-Subscriber
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Don Wilkinson wrote:
> 
> What is the best way to create disk files in a program and write to it?
> I would greatly appreciate the help.
> 
#include <stdio.h>

void main() {
	FILE *f;
	int i=23000;
	char c=100;

	//now use fputi,fputc,fputs,etc.
	
	//ex. write a char to the file
	fputc(f,c);

	//write an int to the file
	fputi(f,i);	

	//use this to close the file
	close(f);

	exit(0);
	}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019