Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

Make money selling software. Check this out here

Hosted clickbank mall. Check this out here




   Misc

   Amazon

   Links

    


Formatted file output using fprintf
 

 

Description

This example uses the fprintf function to write formatted file output . This example requires you to create a blank file called website.txt . In this case on your d: drive .

Code


#include <stdio.h>

int main()
{
FILE *fp;
int rating = 9;
if (fp = fopen("d:/website.txt", "w"))
{
fprintf(fp, "Website: Programmershelp\n");
fprintf(fp, "Topic: computer programming\n");
fprintf(fp, "Rating out of 10 : %d \n",rating );
fclose(fp);
}
else
printf("Error opening d:/website.txt\n");

return 0;
}

Information

tested using LCC Win 32

 

 
 

 

Download

fprintf.txt


 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
File functions(C)
mirror a web page(PHP)
Earth years to other planets(C)
delete a file(C Sharp)
shared resources on your pc(VB)
list files in a folder in a text file(VBScript)
caret blink time(VB)
Open a file and display contents(C++)

    




Copyright © 2003 by programmershelp.co.uk