| www.delorie.com/archives/browse.cgi | search |
| From: | "Morpheus" <hall AT silo DOT csci DOT unt DOT edu> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: make/linking trouble |
| Date: | Sun, 7 Nov 1999 19:32:38 -0600 |
| Organization: | Zion |
| Lines: | 38 |
| Message-ID: | <8059aa$ms3@hermes.acs.unt.edu> |
| References: | <80592o$mnp AT hermes DOT acs DOT unt DOT edu> |
| NNTP-Posting-Host: | dfw-premium-45.dialup.unt.edu |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2314.1300 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
*FileUtils.h*
#ifndef __FILE_UTILS__
#define __FILE_UTILS__
int getFileNumLines(char* file);
#endif __FILE_UTILS__
*FileUtils.cpp*
#include <fstream.h>
#include <iostream.h>
#include "StringUtils.h"
#include "FileUtils.h"
int getFileNumLines(char* file) {
ifstream in = new ifstream(file);
if(!in) {
return 0;
}
char* line = new char[MAX_CHARS + 1];
int numLines = 0;
in.readLine(line, MAX_CHARS);
while(in) {
numLines++;
in.readLine(line, MAX_CHARS);
}
freeString(line);
in.close();
~in();
return numLines;
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |