Main Menu

HOME

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

US Job listings




   Misc

   Amazon

   Links

    


Read data from a file
 

 

 

Description

This opens a file and displays its contents on the screen

Code

/* amethod for displaying the contents of a file
no error checking*/
#include <stdio.h>

void main(void)
{
FILE *fp;
char ch;

fp = fopen("websites.txt","r");
ch = getc(fp);
while(ch!=EOF)
{
putchar(ch);
ch = getc(fp);
}
printf("\n\n");
}

Information

Tested in Visual C++ , LCC Win 32 and Dev C++

 

 

 

 

Download

readafile.txt

websites.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
get the host name(ASP.net)
create a text file(VBScript)
plasma effect(Assembly)
display disk drive properties(Powershell)
Current date and time(C Sharp)
Length of a string(ASP)
3d text effects(Javascript)
A basic calculator(Javascript)

    




Copyright © 2003 by programmershelp.co.uk