diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2008-01-27 11:37:44 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@xenon.tklauser.home> | 2008-01-27 11:37:44 +0100 |
commit | 7e0f021a9aec35fd8e6725e87e3313b101d26f5e (patch) | |
tree | b1cacc4b24393f517aeb4610e9e1021f954307a8 /reference/C/FUNCTIONS |
Initial import (2.0.2-6)2.0.2-6
Diffstat (limited to 'reference/C/FUNCTIONS')
70 files changed, 6590 insertions, 0 deletions
diff --git a/reference/C/FUNCTIONS/Makefile.am b/reference/C/FUNCTIONS/Makefile.am new file mode 100644 index 0000000..28d46b6 --- /dev/null +++ b/reference/C/FUNCTIONS/Makefile.am @@ -0,0 +1,5 @@ +EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) +docs_DATA = $(EXTRA_DIST) + +docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) + diff --git a/reference/C/FUNCTIONS/Makefile.in b/reference/C/FUNCTIONS/Makefile.in new file mode 100644 index 0000000..abc6499 --- /dev/null +++ b/reference/C/FUNCTIONS/Makefile.in @@ -0,0 +1,410 @@ +# KDE tags expanded automatically by am_edit - $Revision: 1.2 $ +# Makefile.in generated automatically by automake 1.5 from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AMTAR = @AMTAR@ +ARTSCCONFIG = @ARTSCCONFIG@ +AS = @AS@ +AUTODIRS = @AUTODIRS@ +AWK = @AWK@ +CC = @CC@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DCOPIDL = @DCOPIDL@ +DCOPIDL2CPP = @DCOPIDL2CPP@ +DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DPMSINC = @DPMSINC@ +DPMSLIB = @DPMSLIB@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +GLINC = @GLINC@ +GLLIB = @GLLIB@ +GMSGFMT = @GMSGFMT@ +IDL = @IDL@ +IDL_DEPENDENCIES = @IDL_DEPENDENCIES@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JAR = @JAR@ +JAVAC = @JAVAC@ +JAVAH = @JAVAH@ +JVMLIBS = @JVMLIBS@ +KDECONFIG = @KDECONFIG@ +KDE_CXXFLAGS = @KDE_CXXFLAGS@ +KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@ +KDE_INCLUDES = @KDE_INCLUDES@ +KDE_LDFLAGS = @KDE_LDFLAGS@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_RPATH = @KDE_RPATH@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +KDE_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@ +LIBCOMPAT = @LIBCOMPAT@ +LIBCRYPT = @LIBCRYPT@ +LIBDL = @LIBDL@ +LIBGEN = @LIBGEN@ +LIBJPEG = @LIBJPEG@ +LIBMICO = @LIBMICO@ +LIBOBJS = @LIBOBJS@ +LIBPNG = @LIBPNG@ +LIBPTHREAD = @LIBPTHREAD@ +LIBPYTHON = @LIBPYTHON@ +LIBQIMGIO = @LIBQIMGIO@ +LIBRESOLV = @LIBRESOLV@ +LIBSHADOW = @LIBSHADOW@ +LIBSM = @LIBSM@ +LIBSOCKET = @LIBSOCKET@ +LIBTIFF = @LIBTIFF@ +LIBTOOL = @LIBTOOL@ +LIBUCB = @LIBUCB@ +LIBUTIL = @LIBUTIL@ +LIBXINERAMA = @LIBXINERAMA@ +LIBZ = @LIBZ@ +LIB_KAB = @LIB_KAB@ +LIB_KDECORE = @LIB_KDECORE@ +LIB_KDEUI = @LIB_KDEUI@ +LIB_KFILE = @LIB_KFILE@ +LIB_KFM = @LIB_KFM@ +LIB_KFORMULA = @LIB_KFORMULA@ +LIB_KHTML = @LIB_KHTML@ +LIB_KIMGIO = @LIB_KIMGIO@ +LIB_KIO = @LIB_KIO@ +LIB_KPARTS = @LIB_KPARTS@ +LIB_KSPELL = @LIB_KSPELL@ +LIB_KSYCOCA = @LIB_KSYCOCA@ +LIB_KWRITE = @LIB_KWRITE@ +LIB_QT = @LIB_QT@ +LIB_SMB = @LIB_SMB@ +LIB_X11 = @LIB_X11@ +LN_S = @LN_S@ +MCOPIDL = @MCOPIDL@ +MEINPROC = @MEINPROC@ +MICO_INCLUDES = @MICO_INCLUDES@ +MICO_LDFLAGS = @MICO_LDFLAGS@ +MOC = @MOC@ +MSGFMT = @MSGFMT@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PAMLIBS = @PAMLIBS@ +PASSWDLIBS = @PASSWDLIBS@ +PYTHONINC = @PYTHONINC@ +PYTHONLIB = @PYTHONLIB@ +PYTHONMODDIR = @PYTHONMODDIR@ +QT_INCLUDES = @QT_INCLUDES@ +QT_LDFLAGS = @QT_LDFLAGS@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SETUIDFLAGS = @SETUIDFLAGS@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +UIC = @UIC@ +UIC_TR = @UIC_TR@ +USER_INCLUDES = @USER_INCLUDES@ +USER_LDFLAGS = @USER_LDFLAGS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +USE_THREADS = @USE_THREADS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XPMINC = @XPMINC@ +XPMLIB = @XPMLIB@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_INCLUDES = @X_INCLUDES@ +X_LDFLAGS = @X_LDFLAGS@ +X_PRE_LIBS = @X_PRE_LIBS@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__include = @am__include@ +am__quote = @am__quote@ +idldir = @idldir@ +install_sh = @install_sh@ +jni_includes = @jni_includes@ +kde_appsdir = @kde_appsdir@ +kde_bindir = @kde_bindir@ +kde_confdir = @kde_confdir@ +kde_datadir = @kde_datadir@ +kde_htmldir = @kde_htmldir@ +kde_icondir = @kde_icondir@ +kde_includes = @kde_includes@ +kde_libraries = @kde_libraries@ +kde_libs_htmldir = @kde_libs_htmldir@ +kde_libs_prefix = @kde_libs_prefix@ +kde_locale = @kde_locale@ +kde_mimedir = @kde_mimedir@ +kde_moduledir = @kde_moduledir@ +kde_qtver = @kde_qtver@ +kde_servicesdir = @kde_servicesdir@ +kde_servicetypesdir = @kde_servicetypesdir@ +kde_sounddir = @kde_sounddir@ +kde_templatesdir = @kde_templatesdir@ +kde_wallpaperdir = @kde_wallpaperdir@ +micodir = @micodir@ +qt_includes = @qt_includes@ +qt_libraries = @qt_libraries@ +x_includes = @x_includes@ +x_libraries = @x_libraries@ + +EXTRA_DIST = $(wildcard *.html) $(wildcard *.htm) $(wildcard *.gif) +docs_DATA = $(EXTRA_DIST) + +docsdir = $(kde_htmldir)/en/kdevelop/$(subdir) +subdir = reference/C/FUNCTIONS +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DATA = $(docs_DATA) + +DIST_COMMON = Makefile.am Makefile.in +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu reference/C/FUNCTIONS/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu reference/C/FUNCTIONS/Makefile + cd $(top_srcdir) && perl admin/am_edit reference/C/FUNCTIONS/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +uninstall-info-am: +install-docsDATA: $(docs_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(docsdir) + @list='$(docs_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(docsdir)/$$f; \ + done + +uninstall-docsDATA: + @$(NORMAL_UNINSTALL) + @list='$(docs_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(docsdir)/$$f"; \ + rm -f $(DESTDIR)$(docsdir)/$$f; \ + done +tags: TAGS +TAGS: + + +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=pclose.html qsort.html errno.htm getchar.html env.html escape.html fputc.html printf.html exit.html srand.html atexit.htm strncmp.html execl.html sprintf.html stat.html memcpy.htm strtol.html clrscr.html fprintf.html free.html read.html strtok.html fclose.html system.html uname.html strcmp.html dec_tab.html atol.html malloc.html puts.html hex_tab.html arglists.html rand.html fgetc.html funcquery.htm setuid.html write.html funcframe.htm bsearch.html atoi.html close.html passwd.html fopen.html strchr.html fgets.html files.html pipe.html kill.html directory.html abort.htm atof.html Master.html strncpy.html open.html time.html strlen.html gets.html strtoul.html format.html strstr.html sscanf.html strpbrk.html funcref.htm getopt.html strcpy.html popen.html fork.html stdlib.html + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(docsdir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-docsDATA + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-docsDATA uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-docsDATA install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-docsDATA \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu reference/C/FUNCTIONS/Makefile + cd $(top_srcdir) && perl admin/am_edit reference/C/FUNCTIONS/Makefile.in + + +#>+ 2 +final: + $(MAKE) all-am +#>+ 2 +final-install: + $(MAKE) install-am +#>+ 2 +no-final: + $(MAKE) all-am +#>+ 2 +no-final-install: + $(MAKE) install-am +#>+ 3 +cvs-clean: + $(MAKE) -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/reference/C/FUNCTIONS/Master.html b/reference/C/FUNCTIONS/Master.html new file mode 100644 index 0000000..6a9b6bf --- /dev/null +++ b/reference/C/FUNCTIONS/Master.html @@ -0,0 +1,64 @@ +<title>XXXX function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>XXXX function </h1> +</center> +<hr> +<b>XXXX</b> +<p> +<hr> +<pre> + Library: stdlib.h + + Prototype: char *gets(char *s); + + Syntax: char read_line[80]; + + gets( read_line); + +</pre> +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif><a href=../EXAMPLES/malloc.c> example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="malloc.html">malloc</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/abort.htm b/reference/C/FUNCTIONS/abort.htm new file mode 100644 index 0000000..2a00c99 --- /dev/null +++ b/reference/C/FUNCTIONS/abort.htm @@ -0,0 +1,69 @@ +<title>ABORT function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>ABORT function </h1> +</center> +<hr> +The <b>abort</b> causes a program to abnormaly terminate. +<p> +<hr> +<pre> + + Library: stdlib.h + + Prototype: void abort(void); + + Syntax: main() + { + abort(); + } + + +</pre> +</font> +<p> +<hr> +<h2>Examples:</h2> + +No example program. + +<hr> +<h2>See Also:</h2> + +<img src="../../GRAPHICS/man.gif"><a href=../MAN/abort.htm> abort</a> function.<p> +<img src="../../GRAPHICS/whiteball.gif"><a href=exit.html> exit</a> function.<p> +<img src="../../GRAPHICS/whiteball.gif"><a href=atexit.htm> atext</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/arglists.html b/reference/C/FUNCTIONS/arglists.html new file mode 100644 index 0000000..8f0842e --- /dev/null +++ b/reference/C/FUNCTIONS/arglists.html @@ -0,0 +1,46 @@ +<title>Function argument lists.</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> + <HR> +<center> +<h1>Function argument lists.</h1> +</center> + <HR> <P> + + +Normally, a function has a fixed number of arguments passed to it. But if +you have used something like 'printf' or 'scanf' you will know that a +variable number of arguments can be passed. This ability is defined by the use +of ... (three periods). <a href=../EXAMPLES/varlist.c>Here is an example.</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/atexit.htm b/reference/C/FUNCTIONS/atexit.htm new file mode 100644 index 0000000..330fabf --- /dev/null +++ b/reference/C/FUNCTIONS/atexit.htm @@ -0,0 +1,81 @@ +<title>ATEXIT function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>ATEXIT function </h1> +</center> +<hr> +<b>atexit</b> regesters a function to be executed when the program +terminates normally. +<p> +<hr> +<pre> + + Library: stdlib.h + + Prototype: int atexit(void (*function)(void)); + + Syntax: void End(void); + + main() + { + atexit(End); + } + + void End(void) + { + printf("The End\n"); + } + +</pre> +</font> +<hr> +Please see +<a href=../CONCEPT/pointers.html#functions>function pointers</a> +for information on how this works. + +<p> +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif align=center><a href=../EXAMPLES/atexit.c> example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif><a href=exit.html> exit</a> function.<p> +<img src=../../GRAPHICS/whiteball.gif><a href=abort.htm> abort</a> function.<p> + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/atof.html b/reference/C/FUNCTIONS/atof.html new file mode 100644 index 0000000..f6d8f6b --- /dev/null +++ b/reference/C/FUNCTIONS/atof.html @@ -0,0 +1,59 @@ +<title>atof function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>atof function </h1> +</center> +<hr> +<p> +<b>atof</b> to be done. + +<pre> +Library: stdlib.h + +Prototype: double atof(const char *ptr); + +Syntax: +</pre> +<img src="../../GRAPHICS/computer.gif"> +<a href="../EXAMPLES/atof.c">example program.</a><p> +<hr> +See also: <p> +<dt><a href="atoi.html">atoi</a> String to integer conversion. +<dt><a href="atol.html">atol</a> String to long integer conversion. +<dt><a href="../MAN/strtod.htm">strtod</a> String to double conversion. +<dt><a href="strtol.html">strtol</a> String to long integer conversion. +<dt><a href="strtoul.html">strtoul</a> String to unsigned long integer +conversion. + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/atoi.html b/reference/C/FUNCTIONS/atoi.html new file mode 100644 index 0000000..279c0fb --- /dev/null +++ b/reference/C/FUNCTIONS/atoi.html @@ -0,0 +1,72 @@ +<title>atoi function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>atoi function </h1> +</center> +<hr> +<p> +<b>atoi</b> to be done. + +<pre> +Library: stdlib.h + +Prototype: + +Syntax: +</pre> +<hr> +<h2>Example:</h2> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/exponent.c#atoi"> example program.</a><p> +<hr> +<h2>See also:</h2> +<p> +<img src=../../GRAPHICS/whiteball.gif> +<a href="atof.html">atof</a> String to floating point conversion. +<br> +<img src=../../GRAPHICS/whiteball.gif> +<a href="atol.html">atol</a> String to long integer conversion. +<br> +<img src=../../GRAPHICS/whiteball.gif> +<a href="../MAN/strtod.htm">strtod</a> String to double conversion. +<br> +<img src=../../GRAPHICS/whiteball.gif> +<a href="strtol.html">strtol</a> String to long integer conversion. +<br> +<img src=../../GRAPHICS/whiteball.gif> +<a href="strtoul.html">strtoul</a> String to unsigned long integer +conversion. + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/atol.html b/reference/C/FUNCTIONS/atol.html new file mode 100644 index 0000000..2a5099c --- /dev/null +++ b/reference/C/FUNCTIONS/atol.html @@ -0,0 +1,60 @@ +<title>atol function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>atol function </h1> +</center> +<hr> +<p> +<b>atol</b> to be done. + +<pre> +Library: stdlib.h + +Prototype: + +Syntax: +</pre> + +<a href=../EXAMPLES/exponent.c><img src=../../GRAPHICS/computer.gif></a> +example program.<p> +<hr> +<h2>See also:</h2> +<p> +<dt><a href=atof.html>atof</a> String to floating point conversion. +<dt><a href=atoi.html>atoi</a> String to integer conversion. +<dt><a href=../MAN/strtod.htm>strtod</a> String to double conversion. +<dt><a href=strtol.html>strtol</a> String to long integer conversion. +<dt><a href=strtoul.html>strtoul</a> String to unsigned long integer +conversion. + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/bsearch.html b/reference/C/FUNCTIONS/bsearch.html new file mode 100644 index 0000000..2c508e1 --- /dev/null +++ b/reference/C/FUNCTIONS/bsearch.html @@ -0,0 +1,60 @@ +<title>bsearch function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center><h1>bsearch function</h1></center> +<hr> +<p> +<b>bsearch</b> will look for an item in a list by performing a binry chop. +The data should be pre-sorted for the search to work. +<p> + +<hr> +<pre> +Library: stdlib.h + +Prototype: + +Syntax: +</pre> + + + +<hr> +<h2>See Also:</h2> + + +<hr> +<h2>Example:</h2> + +<a href=../EXAMPLES/bsearch.c><img src=../../GRAPHICS/computer.gif></a> +Search an integer list. + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/close.html b/reference/C/FUNCTIONS/close.html new file mode 100644 index 0000000..89c3cea --- /dev/null +++ b/reference/C/FUNCTIONS/close.html @@ -0,0 +1,78 @@ +<title>close function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>close function </h1> +</center> +<hr> +<b>close</b> +<p> +<hr> +<pre> + Library: unistd.h + + Prototype: int close(int fd); + + Syntax: int fd; + + close(fd); + +</pre> +<hr> +<p> + +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif align=center><a href="../EXAMPLES/pipe1.c"> pipe example</a> +program. + +<hr> +<h2>Man Pages:</h2> +<img src=../../GRAPHICS/man.gif align=center><a href="../MAN/close.htm"> close man page. </a> + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="pipe.html">pipe</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="open.html">open</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="write.html">write</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="fclose.html">fclose</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/clrscr.html b/reference/C/FUNCTIONS/clrscr.html new file mode 100644 index 0000000..bfd2eb1 --- /dev/null +++ b/reference/C/FUNCTIONS/clrscr.html @@ -0,0 +1,48 @@ +<title>clrscr function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<h1>clrscr function</h1> +<b>clrscr</b> clears the screen. This is non standard. + +<pre> +Library: conio.h + +Prototype: + +Syntax: +</pre> + +See also: +<a href=../EXAMPLES/clrscr.c><img src=../../GRAPHICS/computer.gif></a> +Clear the screen using VT escape codes.<p> + + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/dec_tab.html b/reference/C/FUNCTIONS/dec_tab.html new file mode 100644 index 0000000..b9b7346 --- /dev/null +++ b/reference/C/FUNCTIONS/dec_tab.html @@ -0,0 +1,62 @@ +<title>Decimal Ascii table</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>Decimal Ascii table.</h1> +</center> +<hr> +Here is the Ascii table in base 10. +<pre> + 000 001 002 003 004 005 006 007 + 008 009 010 011 012 013 014 015 + 016 017 018 019 020 021 022 023 + 024 025 026 027 028 029 030 031 + 032 033 ! 034 " 035 # 036 $ 037 % 038 & 039 ' + 040 ( 041 ) 042 * 043 + 044 , 045 - 046 . 047 / + 048 0 049 1 050 2 051 3 052 4 053 5 054 6 055 7 + 056 8 057 9 058 : 059 ; 060 < 061 = 062 > 063 ? + 064 @ 065 A 066 B 067 C 068 D 069 E 070 F 071 G + 072 H 073 I 074 J 075 K 076 L 077 M 078 N 079 O + 080 P 081 Q 082 R 083 S 084 T 085 U 086 V 087 W + 088 X 089 Y 090 Z 091 [ 092 \ 093 ] 094 ^ 095 _ + 096 ` 097 a 098 b 099 c 100 d 101 e 102 f 103 g + 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o + 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w + 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 +</pre> + +And the <a href="hex_tab.html">hex</a> table is here.<p> +<a href="../PROBLEMS/ascii2.c"><img src="../../GRAPHICS/computer.gif"></a> +A program to generate this table. + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/directory.html b/reference/C/FUNCTIONS/directory.html new file mode 100644 index 0000000..2e426f0 --- /dev/null +++ b/reference/C/FUNCTIONS/directory.html @@ -0,0 +1,134 @@ +<title>Directory functions.</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>Directory functions</h1> +</center> +<hr> +<p> + +OK. First things first. These functions are NOT part of the ANSI standard +library. They may not be supported on your platform. +<p> + +Here is a quick summary of each function, they are listed in the order in +which you may want to execute them. +</ul> +<li><b>opendir</b> Open a directory stream. +<li><b>readdir</b> read the current entry in the stream. +<li><b>scandir</b> Find an entry in a direcory. +<li><b>seekdir</b> Jump to a directory offset. +<li><b>telldir</b> Return the current location within the directory stream. +<li><b>rewinddir</b> Return to the start of the directory stream. +<li><b>closedir</b> Close a directory. +</ul> + +<hr> + +<table bgcolor=ivory> +<tr> +<td> +<pre> + + Library: dirent.h + + Prototype: DIR *opendir(const char *name); + + struct dirent *readdir(DIR *dir); + + int scandir(const char *dir, struct dirent ***namelist, + int (*select)(const struct dirent *), + int (*compar)(const void *, const void *)); + + void seekdir(DIR *dir, off_t offset); + + off_t telldir(DIR *dir); + + void rewinddir(DIR *dir); + + int closedir(DIR *dir); +</pre> +</td> +</tr> +</table> + +The dirent structure does not seem to be documented in the man pages, +so here it is. +<p> +<table bgcolor=ivory> +<tr> +<td> +<pre> + + struct dirent + { + long d_ino; + off_t d_off; + unsigned short d_reclen; + char d_name[NAME_MAX+1]; + }; +</pre> +</td> +</tr> +</table> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/dir.c"> example program</a> using opendir, readdir and closedir. +<p> +<hr> +<h2>See Also:</h2> +<img src=../../GRAPHICS/whiteball.gif> +<a href=stat.html>stat</a> function. +<p> +<hr> +<h2>man Pages:</h2> +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/opendir.htm">opendir</a> +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/readdir.htm">readdir</a> +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/scandir.htm">scandir</a> +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/seekdir.htm">seekdir</a> +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/telldir.htm">telldir</a> +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/rewinddir.htm">rewinddir</a> +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/closedir.htm">closedir</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + + + + + diff --git a/reference/C/FUNCTIONS/env.html b/reference/C/FUNCTIONS/env.html new file mode 100644 index 0000000..0692d5c --- /dev/null +++ b/reference/C/FUNCTIONS/env.html @@ -0,0 +1,66 @@ +<title>Enviornmental variable functions</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>Enviornmental variable functions</h1> +</center> +<hr> + +<p> +The following functions allow you to manipulate environmental variables. +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/getenv.htm>getenv</a> Get the value of an environmental variable. +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/putenv.htm>putenv</a> +Change or add an environmental variable. +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/setenv.htm>setenv</a> +Change or add an environmental variable. +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/unsetenv.htm>unsetenv</a> +Remove an environmental variable. +<p> + +<img src=../../GRAPHICS/computer.gif align=center> +<a href=../EXAMPLES/printenv.c>printenv</a> +program. +<p> + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/errno.htm b/reference/C/FUNCTIONS/errno.htm new file mode 100644 index 0000000..a6051f4 --- /dev/null +++ b/reference/C/FUNCTIONS/errno.htm @@ -0,0 +1,64 @@ +<title>XXXX function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>XXXX function </h1> +</center> +<hr> +<b>XXXX</b> +<p> +<hr> +<pre> + Library: stdlib.h + + Prototype: char *gets(char *s); + + Syntax: char read_line[80]; + + gets( read_line); + +</pre> +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif><a href=../EXAMPLES/malloc.c> example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href=malloc.html>malloc</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/escape.html b/reference/C/FUNCTIONS/escape.html new file mode 100644 index 0000000..3ba17a3 --- /dev/null +++ b/reference/C/FUNCTIONS/escape.html @@ -0,0 +1,86 @@ +<title>Escape sequences</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center><h1>Escape sequences</h1></center> +<hr> +<p> + +The following is a list of escape sequences. +<p> +<pre> + \n Newline + \t Horizontal Tab + \v Vertical Tab + \b Backspace + \r Carriage Return + \f Form feed + \a Audible Alert (bell) + \\ Backslash + \? Question mark + \' Single quote + \" Double quote + \000 Oct - No one uses Octal unless they have an ICL background... + \xhh <a href="hex_tab.html">Hex number</a> + <a href="dec_tab.html">Decimal table</a> just for fun. + \ Preprocessor line continuation, must be immediately followed + by a newline. +</pre> +These can be used anywhere that C expects to see a character constant. +Must be time for a quick example. +<pre> + main() + { + char word[]="\x6d\x6f\x64\x65\x6d"; + + printf("%s\n", word); + } +</pre> +Cant you work out what will appear if you ran this program?? +<hr> +<h2>Examples:</h2> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/convesc.c"> Example program.</a> + + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + + + + + + + + + + + + diff --git a/reference/C/FUNCTIONS/execl.html b/reference/C/FUNCTIONS/execl.html new file mode 100644 index 0000000..4f70f63 --- /dev/null +++ b/reference/C/FUNCTIONS/execl.html @@ -0,0 +1,67 @@ +<title>execl family of functions</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>execl family of functions</h1> +</center> +<hr> +<b>execl execlp execle exect execv execvp</b> all performa a simular +function by starting another program. This new program overlays +the existing program, so you can never return to the to original +code unless the call to execl fails. +<p> +<hr> +<pre> + Library: unistd.h + + Prototype: int execl(char *Path, char *arg, (char *)0); + + Syntax: execl("newprog", "newprog", NULL); + +</pre> +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/exec_one.c"> example program issuing the execl.</a> +<p> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/exec_two.c"> The program started by the example above </a> + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="fork.html">fork</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/exit.html b/reference/C/FUNCTIONS/exit.html new file mode 100644 index 0000000..6612140 --- /dev/null +++ b/reference/C/FUNCTIONS/exit.html @@ -0,0 +1,66 @@ +<title>exit function</title> +<head> +<script language="JavaScript"> +</script> +</head +> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>exit function</h1> +</center> +<hr> +<b>exit</b> +causes the program to end and supplies a status code to the +calling environment. + +<pre> +Library: stdlib.h + +Prototype: void exit(int status); + +Syntax: + main() + { + exit(0); /* Clean exit */ + } +</pre> + +<hr> +<p> +No example program. +<p> +<hr> +<h2>See also:</h2> +<img src=../../GRAPHICS/whiteball.gif><a href=../SYNTAX/return.html> return</a> keyword. +<p> +<img src=../../GRAPHICS/whiteball.gif><a href=atexit.htm> atexit</a> function. +<p> +<img src=../../GRAPHICS/whiteball.gif><a href=abort.htm> abort</a> function. + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/fclose.html b/reference/C/FUNCTIONS/fclose.html new file mode 100644 index 0000000..d490814 --- /dev/null +++ b/reference/C/FUNCTIONS/fclose.html @@ -0,0 +1,66 @@ +<title>fclose function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<center> +<hr> +<h1>fclose function</h1> +<hr> +</center> +<p> + +<b>fclose</b> is used to close a file.<p> + +<pre> +Library: stdio.h + +Prototype: int fclose( FILE *stream); + +Syntax: FILE *fp; + fclose(fp); + +</pre> + + +<a href="../EXAMPLES/read_file.c"><img src=../../GRAPHICS/computer.gif></a> +example program.<p> +<hr> +<h2>See Also:</h2> +<ul> +<li><a href="fgetc.html">fgetc</a> Get a character from a file. +<li><a href="fputc.html">fputc</a> Put a character into a file. +<li><a href="fprintf.html">fprintf</a> Put a formatted line into a file. +<li><a href="fopen.html">fopen</a> Open a file. +<li><a href="popen.html">popen</a> Open a pipe. +<li><a href="pclose.html">pclose</a> Close a pipe. +</ul> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/fgetc.html b/reference/C/FUNCTIONS/fgetc.html new file mode 100644 index 0000000..3258acb --- /dev/null +++ b/reference/C/FUNCTIONS/fgetc.html @@ -0,0 +1,69 @@ +<title>fgetc/getc function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>fgetc/getc function</h1> +</center> +<hr> +<b>fgetc</b> and <b>getc</b> both read a character from a file (input stream) +and have the same syntax. They are for all intents and purposes the same! + +<pre> +Library: stdio.h + +Prototype: int fgetc(FILE *stream); + +Syntax: FILE *file_pointer; + char ch; + + ch = fgetc(file_pointer); + ch = getc(file_pointer); + +</pre> +<hr> +<h2>Examples:</h2> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/read_file.c"> Example program.</a> +<p> +<hr> +<p> +<h2>See also:</h2> +<ul> +<li><a href="getchar.html">getchar</a>, +<li><a href="fgets.html">fgets</a>, +<li><a href="gets.html">gets</a>, +</ul> +<p> +getch, getche (non standard) + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/fgets.html b/reference/C/FUNCTIONS/fgets.html new file mode 100644 index 0000000..204a4bc --- /dev/null +++ b/reference/C/FUNCTIONS/fgets.html @@ -0,0 +1,90 @@ +<title>fgets function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center><h1>fgets function </h1></center> +<hr> +<p> +<b>fgets</b> is used to read a line of data from an external source.<p> +<hr> + +<pre> +Library: stdio.h + +Prototype: char *fgets(char *s, int n, FILE *stream); + +Syntax: char Data[80]; + char *ReturnCode; + FILE *FilePointer; + + ReturnCode=fgets(Data, 80, FilePointer); + + ReturnCode == NULL when an error occours. The EOF is + considered to be an ERROR! +</pre> + +<hr> +<h2>Notes</h2> +<ul> +<li>fgets should be used in preference to <a href=gets.html>gets</a> +as it checks that the incoming data does not exceed the buffer size. +<p> + +<li>If fgets is reading STDIN, the +<a href=escape.html>NEWLINE</a> character is placed into +the buffer. <a href=gets.html>gets</a> removes the NEWLINE. +</ul> +<hr> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/fgets.c> example</a> program number one.<p> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/continue.c> example</a> program number two.<p> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/gets.c> program</a> comparing the action of gets and fgets when reading STDIN.<p> + +<hr> +<h2>See Also:</h2> +<ul> +<li><a href=gets.html>gets</a> Read STDIN (keyboard by default). +<li><a href=fgetc.html>fgetc</a> Get a character from a file. +<li><a href=fputc.html>fputc</a> Put a character into a file. +<li><a href=fprintf.html>fprintf</a> Put a formatted line into a file. +<li><a href=fopen.html>fopen</a> Open a file. +<li><a href=fclose.html>fclose</a> Close a file. +<li><a href=popen.html>popen</a> Open a pipe. +<li><a href=pclose.html>pclose</a> Close a pipe. +</ul> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/files.html b/reference/C/FUNCTIONS/files.html new file mode 100644 index 0000000..7053fb7 --- /dev/null +++ b/reference/C/FUNCTIONS/files.html @@ -0,0 +1,89 @@ +<title>Files - Character I/P & O/P functions.</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>Files - character I/P & O/P functions.</h1> +</center> +<hr> + +The following functions allow you to read & write characters in files. +<p> +<hr> +<h2>man pages. </h2> + +<a href="../MAN/fputs.htm">fputs</a> +Write a string. +<p> +<a href="fgetc.html">fgetc</a> +Read a character. +<p> +<a href="fgetc.html">getc</a> +Read a character. +<p> + +<a href="fputc.html">fputc</a> +Write a character to a file. + +<p> +<a href="../MAN/ungetc.htm">ungetc</a> +Return a character. +<p> +<a href="puts.html">puts</a> +Write a string. +<p> +<a href="../MAN/fputs.htm">putchar</a> +Write a string. +<p> +<a href="../MAN/fputs.htm">putc</a> +Write a string. +<p> + +<a href="gets.html">gets</a> +Read a string. + +<p> +<a href="getchar.html">getchar</a> +Read a character. + +<hr> +<h2>Some of my notes</h2> +<a href="fopen.html">fopen</a> Open a file for read or write. +<p> +<a href="fputc.html">fputc</a> Write a character to a file. +<p> +<a href="fclose.html">fclose</a> Close a file. + +<hr> +<a href="../EXAMPLES/read_file.c">Example program.</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/fopen.html b/reference/C/FUNCTIONS/fopen.html new file mode 100644 index 0000000..e85afbc --- /dev/null +++ b/reference/C/FUNCTIONS/fopen.html @@ -0,0 +1,108 @@ +<title>fopen function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>fopen function</h1> +</center> +<hr> +<p> +<b>fopen</b> is used to open a file for read, write or update. +<a href="../MISC/stdfiles.html">stdin, stdout & stderr</a> are opened +by the system at execution time. +<p> + +<table border=2 bgcolor="ivory"> +<tr> +<td> +<pre> + +Library: stdio.h + +Prototype: FILE *fopen(const char *filename, const char *mode); + +Syntax: FILE *fp; + fp = fopen( "/etc/printcap", "r"); + +</pre> +</td> +</tr> +</table> + +<h2>Notes:</h2> +<pre> + filename - is the name of the file. + mode - r - read file. + - w - Write to file. + - a - Append to file. + +</pre> + +<hr> +<h2>Example Programs:</h2> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/read_file.c"> Example program.</a><p> +<hr> +<h2>See Also:</h2> +<dl compact> +<dt><img src=../../GRAPHICS/whiteball.gif> +<dd><a href="fgetc.html">fgetc</a> Get a character from a file. + +<dt><img src=../../GRAPHICS/whiteball.gif> +<dd><a href="fgets.html">fgets</a> Get a record from a file. + +<dt><img src=../../GRAPHICS/whiteball.gif> +<dd><a href="files.html">fputc</a> Put a character into a file. MAN PAGE. + +<dt><img src=../../GRAPHICS/whiteball.gif> +<dd><a href="fprintf.html">fprintf</a> Put a formatted line into a file. + +<dt><img src=../../GRAPHICS/whiteball.gif> +<dd><a href="fclose.html">fclose</a> Close a file. + +<dt><img src=../../GRAPHICS/whiteball.gif> +<dd><a href="pclose.html">pclose</a> Close a pipe. + +<dt><img src=../../GRAPHICS/whiteball.gif> +<dd><a href="system.html">system</a> Open a pipe. + +<dt><img src=../../GRAPHICS/man.gif> +<dd><a href="../MAN/ferror.htm">ferror</a>. +Check error code on a file stream. + +<dt><img src=../../GRAPHICS/man.gif> +<dd><a href="../MAN/ferror.htm">feof</a>. +Check for EOF on a file stream. +</dl> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/fork.html b/reference/C/FUNCTIONS/fork.html new file mode 100644 index 0000000..0601423 --- /dev/null +++ b/reference/C/FUNCTIONS/fork.html @@ -0,0 +1,88 @@ +<title>fork function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>fork function </h1> +</center> +<hr> +<b>fork</b> spawns a copy of the running process. The copy (or child) +has a copy of the parent process stack, data area and heap and starts +execution after the fork statement. fork is of use when you wish to +write daemon processes. +<p> +<hr> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr> +<td width="80%"> +<pre> + + Library: unistd.h + + Prototype: pid_t fork(void); + + Syntax: pid_t PID + + PID = fork(); +</pre> +</td> +</tr> +</table> +</center> +<p> +On completion, PID will have one of the following values: + +<pre> + > 0 == the childs process ID. + 0 == is returned to the child process. + < 0 == an error occoured. No child created, errno is set to + indicate the problem +</pre> +<hr> +<h2>Examples:</h2> + +<img src="../../GRAPHICS/computer.gif"><a href="../EXAMPLES/fork1.c"> example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="pipe.html">pipe function.</a><p> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="execl.html">execl function.</a><p> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="../glossary.html#threads">threads</a><p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/format.html b/reference/C/FUNCTIONS/format.html new file mode 100644 index 0000000..0d18e69 --- /dev/null +++ b/reference/C/FUNCTIONS/format.html @@ -0,0 +1,315 @@ +<title>printf format identifiers.</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>printf format identifiers.</h1> +</center> +<hr> +<p> +printf formatting is controlled by 'format identifiers' which, are shown +below in their simplest form. +<p> +<center> +<table border bgcolor="ivory" width="80%"> +<tr> +<td> +<pre> + + %d %i Decimal signed integer. + %o Octal integer. + %x %X Hex integer. + %u Unsigned integer. + %c Character. + %s String. See below. + %f double + %e %E double. + %g %G double. + %p pointer. + %n Number of characters written by this printf. + No argument expected. + %% %. No argument expected. + +</pre> +</td> +<tr> +</table> +</center> +<p> + +These identifiers actually have upto 6 parts as shown in the table below. +They MUST be used in the order shown. +<p> + +<center> +<table border bgcolor="ivory" width="80%"> +<tr align=center> +<td><a href="#percent">%</a></td> +<td><a href="#flags">Flags</a></td> +<td><a href="#width">Minimum field width</a></td> +<td><a href="#period">Period</a></td> +<td><a href="#precision">Precision. Maximum field width</a></td> +<td><a href="#id">Argument type</a></td> +</tr> +<tr align=center> +<td>Required</td> +<td>Optional</td> +<td>Optional</td> +<td>Optional</td> +<td>Optional</td> +<td>Required</td> +</table> +</center> +<p> + +<a name=percent> +<hr> +<h2>%</h2> +The % marks the start and therfore is manatory. +<p> + +<a name=flags> +<hr> +<h2>Flags</h2> +The format identifers can be altered from their default function by +applying the following <b>flags</b>: +<p> + +<center> +<table border bgcolor="ivory" width="80%"> +<tr> +<td> +<pre> + + - Left justify. + 0 Field is padded with 0's instead of blanks. + + Sign of number always O/P. + blank Positive values begin with a blank. + # Various uses: + %#o (Octal) 0 prefix inserted. + %#x (Hex) 0x prefix added to non-zero values. + %#X (Hex) 0X prefix added to non-zero values. + %#e Always show the decimal point. + %#E Always show the decimal point. + %#f Always show the decimal point. + %#g Always show the decimal point trailing + zeros not removed. + %#G Always show the decimal point trailing + zeros not removed. + +</pre> +</td> +</tr> +</table> +</center> + +<ul> +<li>The flags must follow the <a href="#percent">%</a>. +<li>Where it makes sense, more than one flag can be used. +</ul> +Here are a few more examples. +<p> + +<center> +<table border bgcolor="ivory" width="80%"> +<tr> +<td> +<pre> + + printf(" %-10d \n", number); + printf(" %010d \n", number); + printf(" %-#10x \n", number); + printf(" %#x \n", number); +</pre> +</td> +</tr> +</table> +</center> + +<p> +<a name=width> +<hr> +<h2>Minimum field width.</h2> +By default the width of a field will be the minimum required to hold +the data. If you want to increase the field width you can use the +following syntax. +<p> +<center> +<table border bgcolor="ivory" width="80%"> +<tr> +<td> +<pre> + + main() + { + int number = 5; + char *pointer = "little"; + + printf("Here is a number-%4d-and a-%10s-word.\n", number, pointer); + } + + /********************************* + * + * Program result is: + * + * Here is a number- 5-and a- little-word. + * + *********************************/ +</pre> +</td> +</tr> +</table> +</center> +<p> +As you can see, the data is right justified within the field. It can +be left justified by using the <a href="#flags">- flag</a>. +A <a href="#precision">maximum string</a> width can also be specified. +<p> +The width can also be given as a variable as shown below. +<p> +<center> +<table border bgcolor="ivory" width="80%"> +<tr> +<td> +<pre> + + main() + { + int number=5; + + printf("---%*d----\n", 6, number); + } + + /********************************* + * + * Program result is: + * + * ---- 5--- + * + *********************************/ +</pre> +</td> +</tr> +</table> +</center> +<p> +The * is replaced with the supplied <b>int</b> to provide the ability to +dynamically specify the field width. +<p> +<hr> +<a name=period> +<h2>Period</h2> +If you wish to specify the <a href="#precision">precision</a> of an argument, +it MUST be prefixed with the period. +<p> +<a name=precision> +<hr> +<h2>Precision</h2> + +The Precision takes different meanings for the different format types. + +<h3>Float Precision</h3> +<pre> + %8.2f +</pre> +This says you require a total field of 8 characters, within the 8 +characters the last 2 will hold the decimal part. + +<pre> + %.2f +</pre> + +The example above requests the minimum field width and the last two +characters are to hold the decimal part. + +<h3>Character String Maximum field width</h3> + +The precision within a string format specifies the maximum +field width. +<pre> + %4.8s +</pre> +Specifies a minimum width of 4 and a maximum width +of 8 characters. If the string is greater than 8 characters, +it will be cropped down to size. +<p> +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/sprintf1.c>Here is a little program</a> +that shows an alternative to <a href=strncpy.html>strncpy</a>. + +<h3>* Precision</h3> + +As with the 'width' above, the precision does not have to be hard +coded, the * symbol can be used and an integer supplied to give its +value. +<p> +<hr> +<a name=id> +<h2>Format Identifiers</h2> +The format identifier describes the expected data. The identifier is the +character that ends +Here is a list of the format identifers as used in 'printf' ,'sprintf' +,'fprintf' and 'scanf'. + +<ol> +<li>Except for '%' and 'n', all the identifiers expect to extract an argument +from the <b>printf</b> parameter list. +<li>All of the parmameters should be the value +to be inserted. EXCEPT %s, this expects a <a href="../CONCEPT/pointers.html"> +pointer</a> to be passed. +</ol> +<h2>An example.</h2> +<p> +<center> +<table border bgcolor="ivory" width="80%"> +<tr> +<td> +<pre> + + main() + { + int number=5; + char *pointer="little"; + + printf("Here is a number %d and a %s word.\n", number, pointer); + } + /********************************* + * + * Program result is: + * + * Here is a number 5 and a little word. + * + *********************************/ +</pre> +</td> +</tr> +</table> +</center> +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/fprintf.html b/reference/C/FUNCTIONS/fprintf.html new file mode 100644 index 0000000..e7ff8e2 --- /dev/null +++ b/reference/C/FUNCTIONS/fprintf.html @@ -0,0 +1,52 @@ +<title>fprintf function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>fprintf function</h1> +</center> +<hr> +<p> +<b>fprintf</b> is used to format data and O/P to a file. It +is basically a <a href="printf.html">printf</a> and so uses the same +<a href="escape.html"> escape sequences</a> and <a href="format.html">format +identifers.</a><p> +A related function is +<a href="sprintf.html">sprintf</a> which will O/P formatted text to +a character array.<p> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/fprintf.c"> +example program.</a> +<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/fputc.html b/reference/C/FUNCTIONS/fputc.html new file mode 100644 index 0000000..7ce91b4 --- /dev/null +++ b/reference/C/FUNCTIONS/fputc.html @@ -0,0 +1,77 @@ +<title>fputc function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor="#ffffcc"> +<center> +<hr> +<h1>fputc function</h1> +<hr> +</center> +<p> + +<b>fputc</b> writes one character to a file.<p> +<hr> + +<pre> +Library: stdio.h + +Prototype: int fputc(int c, FILE *stream); + +Syntax: FILE *fp; + int ch = 'a'; + + fp = <a href="fopen.html">fopen</a>("/tmp/file", "w"); + fputc(ch, fp); + <a href="fclose.html">fclose</a>(fp); + +</pre> + +<hr> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/copy_file.c"> +Example program.</a> Copy a file. +<p> +<hr> +<h2>Man pages</h2> +<a href="../MAN/fputs.htm">fputc</a> +<i>Write a character.</i> +<p> +<hr> +<h2>See Also:</h2> +<ul> +<li><a href="fgetc.html">fgetc</a> Get a character from a file. +<li><a href="fprintf.html">fprintf</a> Put a formatted line into a file. +<li><a href="fopen.html">fopen</a> Open a file. +<li><a href="popen.html">popen</a> Open a pipe. +<li><a href="pclose.html">pclose</a> Close a pipe. +</ul> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/free.html b/reference/C/FUNCTIONS/free.html new file mode 100644 index 0000000..439c3c9 --- /dev/null +++ b/reference/C/FUNCTIONS/free.html @@ -0,0 +1,80 @@ +<title>free function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>free function </h1> +</center> +<hr> +<p> +<b>free</b> is used to return allocated memory to the system. +<p> +<hr> +<pre> + Library: <a href="funcref.htm#stdlib">sdlib.h</a> + + Prototype: <a href="../SYNTAX/void.html">void</a> free(void *s); + + Syntax: char *StrPtr; + StrPtr = (char *) malloc(100); + free(StrPtr); + +</pre> +<hr> +<h2>Notes:</h2> +<ul> +<li>If you use <a href="malloc.html">malloc</a> inside a loop and dont <b>free</b> +the memory, you run the risk of the program crashing. +<p> +<li>If a program ends without issuing a <b>free</b>, any allocated memory +is returned to the system. +</uL> +<p> +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif><a href="../EXAMPLES/malloc.c"> example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="malloc.html">malloc</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="../../CPLUSPLUS/SYNTAX/new.html">new</a> C++ replacement for malloc.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="../../CPLUSPLUS/SYNTAX/delete.html">delete</a> C++ replacement for free.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/funcframe.htm b/reference/C/FUNCTIONS/funcframe.htm new file mode 100644 index 0000000..405dc06 --- /dev/null +++ b/reference/C/FUNCTIONS/funcframe.htm @@ -0,0 +1,15 @@ +<html> +<head> +<title>Function reference</title> +</head> + +<frameset rows="55, *" border=0> + +<frame src="funcquery.htm" name="func_head"> +<frame src="funcref.htm" name="func_body"> +</frameset> + +<noframes> +Your browser does not support frames. +</noframes> +</html> diff --git a/reference/C/FUNCTIONS/funcquery.htm b/reference/C/FUNCTIONS/funcquery.htm new file mode 100644 index 0000000..9fa6576 --- /dev/null +++ b/reference/C/FUNCTIONS/funcquery.htm @@ -0,0 +1,37 @@ +<head> +<script> + +// Set up a default search string. + +SubString = "*"; + +function Find(Form) +{ + SubString = Form.data.value + + // Refresh the 'func_body' frame. + + parent.func_body.history.go(0); +} + +</script> + +</head> + +<body bgcolor=#ffffcc> + +<form name="query"> +Please enter a search string. +<input type="text" size=20 name="data"> +<input type="button" Value="Search" OnClick="Find(this.form)"> + +</form> + +<script> + +// Put the default value into the input field. + +document.query.data.value=SubString; +</script> + +</body> diff --git a/reference/C/FUNCTIONS/funcref.htm b/reference/C/FUNCTIONS/funcref.htm new file mode 100644 index 0000000..f97e076 --- /dev/null +++ b/reference/C/FUNCTIONS/funcref.htm @@ -0,0 +1,760 @@ +<html>
+<head>
+<title>C Functions - Quick Ref</title>
+
+<script language="JavaScript">
+
+function W(Str)
+{
+ document.writeln(Str);
+}
+
+function Line(Image, Href, Link, Desc)
+{
+ HSize = 14;
+ WSize = 26;
+
+ if (Image == "man")
+ {
+ HSize = 21;
+ WSize = 26;
+ }
+
+ if (Image == "computer")
+ {
+ HSize = 30;
+ WSize = 27;
+ }
+
+ var Text = "";
+ Text = "<dt> ";
+ Text += "<img src=\"../../GRAPHICS/" + Image + ".gif\" alt=\"o\" height=" + HSize +" width=" + WSize + "> ";
+ Text += "<dd>";
+ Text += "<a href=" + Href + " target=\"_top\">";
+ Text += Link + " </a>";
+ Text += Desc;
+ W(Text);
+}
+
+</script>
+
+</head>
+
+<body bgcolor="ffffcc">
+<hr>
+<center>
+<img src=../../GRAPHICS/function.gif alt="Functions">
+</center>
+<hr>
+<p>
+This is a summary of
+<a href="../glossary.html#ansi">ANSI</a> and
+<a href="../glossary.html#posix">POSIX</a> functions grouped by library. If you want an alphabetical
+list, please use the <a href="../master_index.html">master index</a>.
+Please refer
+to a manual for a complete list of functions available to you.
+<p>
+
+ <ul>
+ <li><a href="#headers">ANSI standard library.</a>
+ <li><a href="#posix">POSIX library.</a>
+ <li><a href="#NONANSI">Non Standard functions from CONIO.H</a>
+ <li><a href="#NONANSIUNIX">Non ANSI Standard Unix functions</a>
+ <li><a href="#USER">User written functions.</a>
+ <li><a href="arglists.html">Variable length argument lists.</a>
+ </ul>
+ <p>
+
+ <hr>
+ <a name="ANSI">
+ <a name="headers">
+ <h2>ANSI standard library.</h2>
+
+ The ANSI library is declared in the following header files.
+ <p>
+ <table border=2 width=100% bgcolor=ivory>
+ <tr align=center><td>
+ <a href="#assert">assert.h</a>
+ </td><td>
+
+ <a href="#ctype">ctype.h</a>
+ </td><td>
+
+ <a href="#errno">errno.h</a>
+ </td><td>
+
+ <a href="#float">float.h</a>
+ </td><td>
+
+ <a href="#limits">limits.h</a>
+ </td>
+ </tr><tr align=center>
+ <td>
+ <a href="#locale">locale.h</a>
+ </td><td>
+
+ <a href="#math">math.h</a>
+ </td><td>
+
+ <a href="#setjmp">setjmp.h</a>
+ </td><td>
+
+ <a href="#signal">signal.h</a>
+ </td><td>
+
+ <a href="#stdarg">stdarg.h</a>
+ </td>
+ </tr><tr align=center>
+ <td>
+ <a href="#stddef">stddef.h</a>
+ </td><td>
+
+ <a href="#stdio">stdio.h</a>
+ </td><td>
+
+ <a href="#stdlib">stdlib.h</a>
+ </td><td>
+
+ <a href="#string">string.h</a>
+ </td><td>
+
+ <a href="#time">time.h</a>
+ </td>
+ </tr>
+ </table>
+
+ <p>
+ <a name=posix>
+ <hr>
+ <h2>POSIX library</h2>
+ The <a href="../glossary.html#posix">POSIX</a> library contains
+ the following headers.
+ <p>
+
+ <table border=2 width=100% bgcolor=ivory>
+ <tr align=center><td>
+ <a href="#cpio">cpio.h</a>
+ </td><td>
+
+ <a href="#dirent">dirent.h</a>
+ </td><td>
+
+ <a href="#fcntl">fcntl.h</a>
+ </td><td>
+
+ <a href="#grp">grp.h</a>
+ </td><td>
+
+ <a href="#pwd">pwd.h</a>
+ </td>
+ </tr><tr align=center>
+ <td>
+ <a href="#stat">sys/stat.h</a>
+ </td><td>
+
+ <a href="#times">sys/times.h</a>
+ </td><td>
+
+ <a href="#types">sys/types.h</a>
+ </td><td>
+
+ <a href="#utsname">sys/utsname.h</a>
+ </td><td>
+
+ <a href="#wait">sys/wait.h</a>
+ </td>
+ </tr><tr align=center>
+ <td>
+ <a href="#tar">tar.h</a>
+ </td><td>
+
+ <a href="#termios">termios.h</a>
+ </td><td>
+
+ <a href="#unistd">unistd.h</a>
+ </td><td>
+
+ <a href="#utime">utime.h</a>
+ </td><td>
+ </tr>
+ </table>
+ <p>
+
+<dl compact>
+
+<hr>
+
+<h2>ANSII Library headers</h2>
+<! ----------------------------------------------------------- >
+<! --- Should be complete and all entries are in master index >
+<! ASSERT.H >
+<a name=assert>
+<dt><hr>
+<dt><h2>assert.h</h2>
+
+<script>
+Line("man", "../MAN/assert.htm", "assert", "");
+</script>
+
+<! ----------------------------------------------------------- >
+<! --- Should be complete and all entries are in master index >
+<! CTYPE.H >
+<a name=ctype>
+<dt><hr>
+<dt><h2>ctype.h</h2>
+
+<script>
+Line("whiteball", "../EXAMPLES/is_examp.c", "isalnum", "Checks whether a character is alphanumeric (A-Z, a-z, 0-9)");
+Line("whiteball", "../EXAMPLES/is_examp.c", "isalpha", "");
+Line("whiteball", "../EXAMPLES/is_examp.c", "iscntrl", "Checks whether a character is a control character or delete ( decimal 0-31 and 127)");
+Line("whiteball", "../EXAMPLES/is_examp.c", "isdigit", "Checks whether a character is a digit (0-9)");
+Line("whiteball", "../EXAMPLES/is_examp.c", "isgraph", "Checks whether a character is a printable character, excluding the space (decimal 32)");
+Line("whiteball", "../EXAMPLES/is_examp.c", "islower", "Checks whether a character is a lower case letter (a-z).");
+Line("whiteball", "../EXAMPLES/is_examp.c", "isprint", "Checks whether a character is printable (decimal 32-126).");
+Line("whiteball", "../EXAMPLES/is_examp.c", "ispunct", "Checks whether a character is punctuation (decimal 32-47, 58-63, 91-96, 123-126)");
+Line("whiteball", "../EXAMPLES/is_examp.c", "isspace", "Checks whether a character is white space - space, CR HT VT NL, FF.");
+Line("whiteball", "../EXAMPLES/is_examp.c", "isupper", "Checks whether a character is an upper case letter (A-Z).");
+Line("whiteball", "../EXAMPLES/is_examp.c", "isxdigit", "Checks whether a character is hex digit (0-9, A-F, a-f).");
+Line("man", "../MAN/toupper.htm", "toupper", "Converts a lowercase character to uppercase.");
+Line("man", "../MAN/toupper.htm", "tolower", "Convert an uppercase character to lowercase.");
+</script>
+
+<! ----------------------------------------------------------- >
+<! ERRNO.H >
+<a name=errno>
+<dt><hr>
+<h2>errno.h</h2>
+
+<script>
+Line("man", "../FUNCTIONS/errno.htm", "errno", "");
+</script>
+
+<! ----------------------------------------------------------- >
+<! FLOAT.H >
+<a name=float>
+<dt><hr>
+<dt><h2>float.h</h2>
+
+No functions are <a href="../SYNTAX/functions.html#2.2">declared</a> in stddef.h.
+<! ----------------------------------------------------------- >
+<! LIMITS.H >
+<a name=limits>
+<dt><hr>
+<dt><h2>limits.h</h2>
+
+No functions are <a href="../SYNTAX/functions.html#2.2">declared</a> in stddef.h.
+<! ----------------------------------------------------------- >
+<! LOCALE.H >
+<a name=locale>
+<dt><hr>
+<dt><h2>locale.h</h2>
+
+<script>
+Line("man", "../MAN/setlocale.htm", "setlocale", "");
+</script>
+
+<! ----------------------------------------------------------- >
+<! MATH.H >
+<! --- Should be complete. master index done >
+<dt><hr>
+<a name=math>
+<dt><h2>math.h</h2>
+
+<script>
+Line("man", "../MAN/acos.htm", "acos", "");
+Line("man", "../MAN/asin.htm", "asin", "");
+Line("man", "../MAN/atan.htm", "atan", "");
+Line("man", "../MAN/atan2.htm", "atan2", "");
+Line("man", "../MAN/ceil.htm", "ceil", "smallest integral value not less than x");
+Line("man", "../MAN/cos.htm", "cos", "Cosine.");
+Line("man", "../MAN/cosh.htm", "cosh", "");
+Line("man", "../MAN/exp.htm", "exp", "");
+Line("man", "../MAN/fabs.htm", "fabs", "absolute value of floating-point number");
+Line("man", "../MAN/floor.htm", "floor", "largest integral value not greater than x");
+Line("man", "../MAN/fmod.htm", "fmod", "floating-point remainder function");
+Line("man", "../MAN/frexp.htm", "frexp", "");
+Line("man", "../MAN/ldexp.htm", "ldexp", "");
+Line("man", "../MAN/exp.htm", "log", "");
+Line("man", "../MAN/exp.htm", "log10", "");
+Line("man", "../MAN/modf.htm", "modf", "");
+W("<a name=power>");
+Line("man", "../MAN/exp.htm", "pow", "Raise a number by a power.");
+Line("man", "../MAN/sin.htm", "sin", "The sine of an integer.");
+Line("man", "../MAN/sinh.htm", "sinh", "");
+W("<a name=square>");
+Line("man", "../MAN/sqrt.htm", "sqrt", "Square root of a number.");
+Line("man", "../MAN/tan.htm", "tan", "Tangent.");
+Line("man", "../MAN/tanh.htm", "tanh", "Hyperbolic tangent.");
+
+</script>
+
+<h3>Note</h3> For some reason <b>abs</b> is in <a href="#stdlib">stdlib.h</a>
+
+<! ----------------------------------------------------------- >
+<! SETJMP.H >
+<a name=setjmp>
+<dt><hr>
+
+<dt><h2>setjmp.h</h2>
+
+<script>
+Line("man", "../MAN/setjmp.htm", "setjmp", "");
+Line("man", "../MAN/longjmp.htm", "longjmp", "");
+</script>
+
+<! ----------------------------------------------------------- >
+<! SIGNAL.H >
+<a name=signal>
+<dt><hr>
+<dt><h2>signal.h</h2>
+
+<script>
+Line("man", "../MAN/signal.htm", "signal", "");
+Line("man", "../MAN/raise.htm", "raise", "");
+</script>
+
+<! ----------------------------------------------------------- >
+<! STDARG.H >
+<a name=stdarg>
+<dt><hr>
+<dt><h2>stdarg.h</h2>
+
+<script>
+Line("man", "../MAN/va_start.htm", "va_start", "");
+Line("man", "../MAN/va_start.htm", "va_arg", "");
+Line("man", "../MAN/va_start.htm", "va_end", "");
+Line("whiteball", "../SYNTAX/functions.html#2.7", "An example of use", "");
+</script>
+<p>
+See also <a href=#stdio>vprintf vfprintf and vsprintf</a> which all print the contents of a va_list
+<! ----------------------------------------------------------- >
+<! STDDEF.H >
+<a name=stddef>
+<dt><hr>
+<dt><h2>stddef.h</h2>
+No functions are <a href="../SYNTAX/functions.html#2.2">declared</a> in stddef.h.
+
+<! ----------------------------------------------------------- >
+<! --- Not complete. master index to be done >
+<! STDIO.H >
+<a name=stdio>
+<dt><hr>
+<h2>stdio.h</h2>
+
+This header defines all the ANSI I/O functions that allow you to read
+and write to files and devices.
+<a href="../MISC/io.html#low">Low level</a> (non ANSI) functions are also available.
+<p>
+
+<script>
+Line("man", "../MAN/ferror.htm", "clearerr", "");
+Line("whiteball", "fclose.html", "fclose", "Close a file.");
+Line("whiteball", "../EXAMPLES/continue.c", "feof", "Check for EOF while reading a file.");
+Line("man", "../MAN/fflush.htm", "fflush", "");
+Line("whiteball", "fgetc.html", "fgetc", "Read a character from a file.");
+Line("man", "../MAN/fgetpos.htm", "fgetpos", "");
+Line("whiteball", "fgets.html", "fgets", "Read a record from a file (safer than fgetc).");
+Line("whiteball", "fopen.html", "fopen", "Open a file");
+Line("whiteball", "fprintf.html", "fprintf", "O/P a line of data to a file.");
+Line("whiteball", "files.html", "fputc", "Put a charater into a file.");
+Line("whiteball", "files.html", "fputs", "Put a string into a file.");
+Line("man", "../MAN/fread.htm", "fread", "");
+Line("man", "../MAN/freopen.htm", "freopen", "");
+Line("man", "../MAN/fscanf.htm", "fscanf", "");
+Line("man", "../MAN/fgetpos.htm", "fseek", "");
+Line("man", "../MAN/fgetpos.htm", "fsetpos", "");
+Line("man", "../MAN/fgetpos.htm", "ftell", "");
+Line("man", "../MAN/fread.htm", "fwrite", "");
+Line("whiteball", "fgetc.html", "getc", "Get a character from an input stream.");
+Line("whiteball", "getchar.html", "getchar", "Get a character from the keyboard (STDIN).");
+Line("whiteball", "gets.html", "gets", "Get string (from keyboard).");
+Line("man", "../MAN/perror.htm", "perror", "");
+Line("whiteball", "printf.html", "printf", "O/P data to the screen or a file.");
+Line("man", "../MAN/puts.htm", "putchar", "O/P a character to STDOUT.");
+Line("whiteball", "puts.html", "puts", "O/P data to the screen or a file.");
+Line("man", "../MAN/remove.htm", "remove", "Remove a file.");
+Line("man", "../MAN/fgetpos.htm", "rewind", "");
+Line("man", "../MAN/scanf.htm", "scanf", "");
+Line("man", "../MAN/setbuf.htm", "setbuf", "");
+Line("man", "../MAN/setvbuf.htm", "setvbuf", "");
+Line("whiteball", "sprintf.html", "sprintf", "O/P data in tha same way as 'printf' but put it into a string.");
+Line("whiteball", "sscanf.html", "sscanf", "Extract fields from a string.");
+Line("man", "../MAN/tmpfile.htm", "tmpfile", "");
+Line("man", "../MAN/tmpnam.htm", "tmpnam", "");
+Line("man", "../MAN/gets.htm", "ungetc", "");
+Line("man", "../MAN/vfprintf.htm", "vfprintf", "O/P a va_list to a file.");
+Line("man", "../MAN/vfprintf.htm", "vprintf", "O/P a va_list to stdout.");
+Line("man", "../MAN/vfprintf.htm", "vsprintf", "O/P a va_list to a string.");
+</script>
+
+<! ----------------------------------------------------------- >
+<! --- Complete. master index to be done >
+<! STDLIB.H -->
+<a name=stdlib>
+<dt><hr>
+<dt><h2>stdlib.h</h2>
+
+<script>
+Line("whiteball", "abort.htm", "abort", "a program.");
+Line("man", "../MAN/abs.htm", "abs", "compute the absolute value of an integer.");
+Line("whiteball", "atexit.htm", "atexit", "Execute the named function when the program terminates.");
+Line("whiteball", "atof.html", "atof", "convert a string to a double");
+Line("whiteball", "../EXAMPLES/exponent.c#atoi", "atoi", "Accepts +-0123456789 leading blanks and converts to integer.");
+Line("whiteball", "atol.html", "atol", "convert a string to a long integer");
+Line("whiteball", "bsearch.html", "bsearch", "Binary chop.");
+Line("man", "../MAN/calloc.htm", "calloc", "memory for an array.");
+Line("man", "../MAN/div.htm", "div", "compute the quotient and remainder of integer division");
+Line("whiteball", "exit.html", "exit", "Normally terminate a program.");
+Line("whiteball", "env.html", "getenv", "Get an environmental variable.");
+Line("whiteball", "free.html", "free", "memory allocated with malloc.");
+Line("man", "../MAN/labs.htm", "labs", "compute the absolute value of a long integer");
+Line("man", "../MAN/div.htm", "ldiv", "compute the quotient and remainder of long integer division.");
+Line("whiteball", "malloc.html", "malloc", "dynamically allocate memory.");
+Line("man", "../MAN/mblen.htm", "mblen", "determine the number of bytes in a character");
+Line("man", "../MAN/mbstowcs.htm", "mbstowcs", "convert a multibyte string to a wide character string.");
+Line("man", "../MAN/mbtowc.htm", "mbtowc", "convert a multibyte character to a wide character");
+Line("whiteball", "qsort.html", "qsort", "Sort an array.");
+Line("whiteball", "rand.html", "rand", "Generate a random number.");
+Line("man", "../MAN/realloc.htm", "realloc", "Reallocate memory.");
+Line("man", "../MAN/strtod.htm", "strtod", "Convert a string to a double.");
+Line("whiteball", "strtol.html", "strtol", "String to long integer conversion. Takes data in various number bases.");
+Line("whiteball", "strtoul.html", "strtoul", "Convert a string to an unsigned long. This can also perform number base conversion.");
+Line("whiteball", "srand.html", "srand", "Seed a random number.");
+Line("whiteball", "system.html", "system", "Issue a command to the operating system");
+Line("man", "../MAN/wctomb.htm", "wctomb", "convert a wide character to a multibyte character.");
+Line("man", "../MAN/wcstombs.htm", "wcstombs", "convert a wide character string to a multibyte character string.");
+</script>
+
+
+<! ----------------------------------------------------------- >
+<! --- Complete. master index to be done >
+<! STRING.H >
+<a name=string>
+<dt><hr>
+<dt><h2>string.h</h2>
+
+<script>
+Line("man", "../MAN/memchr.htm", "memchr", "Copy a character into memory.");
+Line("man", "../MAN/memcmp.htm", "memcmp", "Compare memory locations.");
+Line("whiteball", "memcpy.htm", "memcpy", "Copy memory.");
+Line("man", "../MAN/memmove.htm", "memmove", "Move memory.");
+Line("man", "../MAN/memset.htm", "memset", "Set memory.");
+Line("man", "../MAN/strcat.htm", "strcat", "Concatinate two strings.");
+
+W("<a name=strchr>");
+Line("whiteball", "strchr.html", "strchr", "Search for a character in a string.");
+
+Line("whiteball", "strcmp.html", "strcmp", "Compare strings.");
+Line("man", "../MAN/strcoll.htm", "strcoll", "");
+Line("whiteball", "strcpy.html", "strcpy", "Copy strings.");
+Line("man", "../MAN/strcspn.htm", "strcspn", "");
+Line("man", "../MAN/strerror.htm", "strerror", "");
+Line("whiteball", "strlen.html", "strlen", "Length of a string.");
+Line("man", "../MAN/strcat.htm", "strncat", "Concatinate two strings.");
+Line("whiteball", "strncmp.html", "strncmp", "Compare two strings.");
+Line("whiteball", "strncpy.html", "strncpy", "Copy part of a string.");
+Line("whiteball", "strpbrk.html", "strpbrk", "");
+Line("whiteball", "strchr.html", "strrchr", "Search for a character in a string.");
+Line("man", "../MAN/strspn.htm", "strspn", "");
+Line("whiteball", "strstr.html", "strstr", "Search a string for a substring.");
+Line("whiteball", "strtok.html", "strtok", "The books say this function splits a string into tokens. I think its function is best described as parsing a string.");
+Line("whiteball", "time.html", "strxfrm", "");
+</script>
+
+<! ----------------------------------------------------------- >
+<! TIME.H >
+<! --- Should be complete. master index done >
+<a name=time>
+<dt><hr>
+<dt><h2>time.h</h2>
+
+<script>
+Line("man", "../MAN/asctime.htm", "asctime", "");
+Line("man", "../MAN/clock.htm", "clock", "");
+Line("man", "../MAN/asctime.htm", "ctime", "");
+Line("man", "../MAN/difftime.htm", "difftime", "");
+Line("man", "../MAN/asctime.htm", "gmtime", "");
+Line("man", "../MAN/asctime.htm", "localtime", "");
+Line("man", "../MAN/asctime.htm", "mktime", "");
+Line("man", "../MAN/strftime.htm", "strftime", "");
+Line("man", "../MAN/time.htm", "time", "");
+Line("computer", "../EXAMPLES/time.c", "Example", "program using some of the time functions.");
+</script>
+
+<dt><hr>
+<h2>POSIX functions start here....</h2>
+<! -------------------------------------------------->
+<a name=cpio>
+<dt><hr>
+
+<h2>cpio.h</h2>
+
+<! -------------------------------------------------->
+<a name=dirent>
+<dt><hr>
+
+<h2>dirent.h</h2>
+
+<script>
+Line("whiteball", "directory.html", "opendir", "Open a directory.");
+Line("whiteball", "directory.html", "closedir", "Close a directory.");
+Line("whiteball", "directory.html", "readdir", "Read a directory entry.");
+Line("whiteball", "directory.html", "rewinddir", "Return to the beginning of a directory.");
+Line("whiteball", "directory.html", "scandir", "Scan a directory for a matching entry.");
+Line("whiteball", "directory.html", "seekdir", "Move to an offset in a directory.");
+Line("whiteball", "directory.html", "telldir", "Return the location within a directory.");
+</script>
+
+<! -------------------------------------------------->
+<a name=fcntl>
+<dt><hr>
+
+<h2>fcntl.h</h2>
+
+<! -------------------------------------------------->
+<a name=grp>
+<dt><hr>
+
+<h2>grp.h</h2>
+
+<! -------------------------------------------------->
+<a name=pwd>
+<dt><hr>
+
+<h2>pwd.h</h2>
+
+<! -------------------------------------------------->
+<a name=stat>
+<dt><hr>
+
+<h2>sys/stat.h</h2>
+
+<! -------------------------------------------------->
+<a name=times>
+<dt><hr>
+
+<h2>sys/times.h</h2>
+
+<! -------------------------------------------------->
+<a name=types>
+<dt><hr>
+
+<h2>sys/types.h</h2>
+
+<! -------------------------------------------------->
+<a name=utsname>
+<dt><hr>
+
+<h2>sys/utsname.h</h2>
+
+<! -------------------------------------------------->
+<a name=wait>
+<dt><hr>
+
+<h2>sys/wait.h</h2>
+
+<! -------------------------------------------------->
+<a name=tar>
+<dt><hr>
+
+<h2>tar.h</h2>
+
+<! -------------------------------------------------->
+<a name=termios>
+<dt><hr>
+
+<h2>termios.h</h2>
+
+<! -------------------------------------------------->
+<a name=unistd>
+<dt><hr>
+
+<h2>unistd.h</h2>
+
+It seems that this library contains headers for many functions that originally came with the ANSII
+standard library but did not have headers.
+<b>My documentation for this POSIX library is incomplete.</b>
+
+<script>
+Line("man", "../MAN/access.htm", "access", "");
+Line("man", "../MAN/alarm.htm", "alarm", "");
+Line("man", "../MAN/chdir.htm", "chdir", "Change the current working directory.");
+Line("man", "../MAN/chown.htm", "chown", "Change the ownership of a file.");
+Line("whiteball", "../FUNCTIONS/close.html", "close", "Close a file (see <a href=\"../MISC/io.html#low\">low level functions</a>)");
+Line("man", "../MAN/chroot.htm", "chroot", "Change the root directory I am not 100% sure this is supposed to be in unistd.");
+Line("man", "../MAN/ctermid.htm", "ctermid", "");
+Line("man", "../MAN/cuserid.htm", "cuserid", "");
+Line("man", "../MAN/dup2.htm", "dup", "duplicate a file descriptor");
+Line("man", "../MAN/dup2.htm", "dup2", "duplicate a file descriptor");
+Line("whiteball", "execl.html", "execl", "");
+Line("whiteball", "execl.html", "execle", "");
+Line("whiteball", "execl.html", "execlp", "");
+Line("whiteball", "execl.html", "execv", "");
+Line("whiteball", "execl.html", "execve", "");
+Line("whiteball", "execl.html", "execvp", "");
+Line("man", "../MAN/chdir.htm", "fchdir", "Change the current working directory.I am not 100% sure this is supposed to be in unistd.");
+Line("whiteball", "fork.html", "fork", "Create a child process.");
+Line("man", "../MAN/pathconf.htm", "fpathconf", "Change the current working directory.I am not 100% sure this is supposed to be in unistd.");
+Line("whiteball", "setuid.html", "getegid", "Get the group ID of the process.");
+Line("whiteball", "setuid.html", "geteuid", "Get the User ID of the process.");
+Line("man", "../MAN/gethostname.htm", "gethostname", "Name of the host (see <a href=\"#uname\">uname</a>). Not 100% sure this is in unistd");
+Line("whiteball", "../MAN/getopt.html", "getopt,", "parse the command line Not 100% sure this is in unistd.");
+Line("man", "../MAN/getgid.htm", "getgid", "Get a group ID.");
+Line("man", "../MAN/getgroups.htm", "getgroups", "");
+Line("man", "../MAN/getlogin.htm", "getlogin", "");
+Line("man", "../MAN/getpgrp.htm", "getpgrp", "");
+Line("man", "../MAN/getpid.htm", "getpid", "get process ID.");
+Line("man", "../MAN/getpid.htm", "getppid,", "get parent process ID.");
+Line("whiteball", "setuid.html", "getuid", "Get the User ID of the process.");
+Line("man", "../MAN/isatty.htm", "isatty", "");
+Line("man", "../MAN/link.htm", "link", "");
+Line("man", "../MAN/lseek.htm", "lseek", "");
+Line("man", "../MAN/mkdir.htm", "mkdir", "Make a directory");
+Line("whiteball", "open.html", "open", "Open a file");
+Line("man", "../MAN/fpathconf.htm", "pathconf", "");
+Line("man", "../MAN/pause.htm", "pause", "Put the program to sleep.");
+Line("whiteball", "pipe.html", "pipe", "");
+Line("whiteball", "read.html", "read", "Read a file descriptor.");
+Line("man", "../MAN/rename.htm", "rename", "Rename a file. This function can also be found in the ANSI stdio library. MAN PAGE.");
+Line("man", "../MAN/rmdir.htm", "rmdir", "Remove a directory");
+
+Line("whiteball", "setuid.html", "setgid", "Set the Group ID of the process.");
+Line("man", "../MAN/setpgid.htm", "setpgid", "");
+Line("man", "../MAN/setsid.htm", "setsid", "");
+W("<a name=setuid>");
+Line("whiteball", "setuid.html", "setuid", "Set the User ID of the process.");
+W("<a name=sleep>");
+Line("whiteball", "../MAN/sleep.htm", "sleep", "Pause for a required number of seconds.");
+Line("man", "../MAN/sysconf.htm", "sysconf", "");
+Line("man", "../MAN/tcgetpgrp.htm", "tcgetpgrp", "");
+Line("man", "../MAN/tcgetpgrp.htm", "tcsetpgrp", "");
+Line("man", "../MAN/ttyname.htm", "ttyname", "");
+Line("man", "../MAN/unlink.htm", "unlink", "Remove a file");
+Line("whiteball", "write.html", "write", "Write to a file descriptor.");
+</script>
+
+<! -------------------------------------------------->
+<a name=utime>
+<dt><hr>
+
+<h2>utime.h</h2>
+
+<dt><hr>
+<! -------------------------------------------------->
+<a name="NONANSI">
+<dt><hr>
+
+<h2>conio.h</h2>
+Dos Specific functions in conio.h Not very portable as conio.h
+is NOT in the ANSI standard library and does not
+appear on the Sun or Linux machines.
+<p>
+
+<script>
+Line("whiteball", "clrscr.html", "clrscr", "Clear screen");
+Line("whiteball", "", "getch", "Get a character from the keyboard.");
+Line("whiteball", "", "getche", "Get a character from the keyboard.");
+</script>
+
+</dl>
+<hr><hr>
+
+<a name="NONANSIUNIX">
+<h2>Non ANSI Standard Unix Functions.</h2>
+These functions are not in the ANSI standard libraries but are handy
+all the same.
+<p>
+
+<dl compact>
+<script>
+Line("whiteball", "#dirent", "dirent.h", "Functions performing actions on directories");
+Line("computer", "../EXAMPLES/statfs.c", "statfs", "Filesystem statistics.");
+Line("whiteball", "#unistd", "unistd.h", "");
+Line("whiteball", "#hotchpotch", "Ungrouped functions.", "");
+</script>
+</dl>
+
+<! -------------------------------------------------->
+
+
+</dl>
+
+<! -------------------------------------------------->
+<a name="hotchpotch">
+<hr>
+<h2>Ungrouped functions</h2>
+<dl compact>
+
+<script>
+Line("whiteball", "passwd.html", "endpwent", "");
+Line("whiteball", "passwd.html", "fgetpwent", "");
+Line("whiteball", "passwd.html", "getpw", "Get a password entry.");
+Line("whiteball", "passwd.html", "getpwent", "Get a password entry.");
+Line("whiteball", "passwd.html", "getpwnam", "Get a record by keying on the user name.");
+Line("whiteball", "passwd.html", "getpwuid", "Get a record by keying on the UID (numeric).");
+Line("whiteball", "setuid.html", "getuidx", "Get the User ID of a process (RS/6000 only).");
+Line("whiteball", "strchr.html", "index", "Search for a character in a string (Use <a href=#strchr>strchr</a> to conform to the ANSI standard).");
+
+Line("whiteball", "passwd.html", "putpwent", "");
+Line("whiteball", "pclose.html", "pclose", "Close a pipe.");
+Line("whiteball", "popen.html", "popen", "Open a Unix pipe.");
+Line("whiteball", "env.html", "putenv", "Change or create an environmental variable.");
+
+Line("whiteball", "env.html", "setenv", "Change or create an environmental variable.");
+Line("whiteball", "passwd.html", "setpwent", "");
+Line("whiteball", "setuid.html", "setreuid", "Set the ID of the process calling process.");
+Line("whiteball", "stat.html", "stat", "Get status information on files (modification time, file size etc).");
+W("<a name=uname>");
+Line("whiteball", "uname.html", "uname", "Get information about the machine we are running on.");
+Line("whiteball", "env.html", "unsetenv", "Remove an environmental variable.");
+Line("whiteball", "setuid.html", "setuidx", "Set the User ID of the process (RS/6000 only).");
+Line("whiteball", "setuid.html", "setegid setrgid", "Set the Group ID of the process.");
+W("<a name=setuid>");
+Line("whiteball", "setuid.html", "seteuid setruid", "Set the User ID of the process.");
+Line("whiteball", "setuid.html", "getruid", "Get the User ID of the process.");
+Line("whiteball", "../SYNTAX/sizeof.html", "sizeof", "Return the storage allocation for a <a href=../CONCEPT/data_types.html>data type.</a>This is actually an operator! I have put it in here as it looks like a function and so you will probably look for it here....");
+
+Line("computer", "../EXAMPLES/sizeof.c", "example", "showing the size of data types");
+Line("computer", "../EXAMPLES/sizeof1.c", "example", "showing the size of data objects.");
+
+<dt>
+<hr>
+<a name="USER">
+<hr>
+<h2>User written functions <br>(and a few lifted from books)</h2>
+<hr>
+
+Line("computer", "../EXAMPLES/clrscr.c", "clrscr.", "Clear the screen using VT escape sequence.");
+Line("computer", "../EXAMPLES/convesc.c", "convesc.", "Insert escape codes into a text string.");
+Line("computer", "../EXAMPLES/basename.c", "basename.", "Strip directory information from a Unix file name.");
+Line("computer", "../EXAMPLES/printenv.c", "printenv.", "List the environmental variables.");
+Line("computer", "../EXAMPLES/lenstr.c", "lenstr", "User written version of <a href=strlen.html>strlen</a>", "");
+Line("computer", "../EXAMPLES/reverse.c", "reverse", "Reverse characters in a string.");
+
+<!-- Start of footer. -->
+</dl>
+
+<p>
+<hr>
+<p>
+<center>
+<table border=2 width=80% bgcolor="ivory">
+<tr align=center>
+<td width="25%">
+<a href="../cref.html"> Top</a>
+</td><td width="25%">
+<a href="../master_index.html"> Master Index</a>
+</td><td width="25%">
+<a href="../SYNTAX/keywords.html"> Keywords</a>
+</td><td width="25%">
+<a href="funcref.htm"> Functions</a>
+</td>
+</tr>
+</table>
+</center>
+<p>
+<hr>
+<address>Martin Leslie
+</address><p>
+</body>
+</html>
diff --git a/reference/C/FUNCTIONS/getchar.html b/reference/C/FUNCTIONS/getchar.html new file mode 100644 index 0000000..1b37071 --- /dev/null +++ b/reference/C/FUNCTIONS/getchar.html @@ -0,0 +1,75 @@ +<title>getchar function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>getchar function </h1> +<hr> +</center> +<p> +<b>getchar</b> is used to read data from the keyboard ( +<a href=../MISC/stdfiles.html>stdin</a>). Effectivly +it is a <b>fgetc(stdin)</b>.<p> +The problem with this function is that the characters are buffered until +RETURN is hit! This means that <b>getchar</b> does not see the characters +until the user presses return. The non standard function <b>getche</b> +gets around this problem and sees each character as it is pressed. +I have not been able to produce the same function on Linux. +The nearest I can get is by using 'curses' but it keeps clearing the screen! + +<pre> +Library: stdio.h + +Prototype: int getchar(void); + +Syntax: ch = getchar(); + +</pre> + + +<a href=../EXAMPLES/getchar.c><img src=../../GRAPHICS/computer.gif></a> +example program. +<p> + +<hr> +<p> +See also: +<ul> +<li><a href=fgetc.html>fgetc</a> +<li><a href=fgetc.html>getc</a> +<li><a href=fgets.html>fgets</a> +<li><a href=gets.html>gets</a> +<p> +<li>getch (non standard) +<li>getche (non standard). +</ul> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/getopt.html b/reference/C/FUNCTIONS/getopt.html new file mode 100644 index 0000000..e6f3cb3 --- /dev/null +++ b/reference/C/FUNCTIONS/getopt.html @@ -0,0 +1,54 @@ +<title>getopt function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>getopt function</h1> +</center> +<hr> + + + +<hr> +<h2>Examples:</h2> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/command_line.c"> Example using argc and argv</a> +<hr> +<h2>See Also:</h2> +<img src=../../GRAPHICS/whiteball.gif> +<a href="../CONCEPT/cmdline.html">command line</a> arguments (argc/argv). + +<br> +<p><img src=../../GRAPHICS/man.gif> +<a href="../MAN/getopt.htm">getopt</a> man page. + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/gets.html b/reference/C/FUNCTIONS/gets.html new file mode 100644 index 0000000..400b7a5 --- /dev/null +++ b/reference/C/FUNCTIONS/gets.html @@ -0,0 +1,81 @@ +<title>fgets function</title> +<head> +<script language="JavaScript"> +</script> +</head> +<body bgcolor=#ffffcc> +<hr> +<center><h1>gets function </h1></center> +<hr> +<p> +<b>gets</b> is used to read a line of data from +<a href=../MISC/stdfiles.html>STDIN</a>. By default STDIN is the +keyboard. <b>gets</b> continues to read characters until NEWLINE or EOF +is seen. +<p> + +<pre> +Library: stdio.h + +Prototype: char *gets(char *s); + +Syntax: char read_line[80]; + + gets( read_line); +</pre> + +<h2>Notes</h2> +<ol> +<li><b>gets</b> does NOT check the size of the buffer and overflow on the +stack can occour. Because of this, you should use +<a href=fgets.html>fgets</a> in preferance. +<p> + +<li>The +<a href=escape.html>NEWLINE</a> +character is NOT placed in the buffer. +<a href=fgets.html>fgets</a> will retain the +<a href=escape.html>NEWLINE</a>. +</ul> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/gets.c>example</a> +showing fgets and gets in action.<p> +<hr> +<h2>See Also:</h2> +<ul> +<li><a href=fgets.html>fgets</a> Get a string from a file. +<li><a href=fgetc.html>fgetc</a> Get a character from a file. +<li><a href=fputc.html>fputc</a> Put a character into a file. +<li><a href=fprintf.html>fprintf</a> Put a formatted line into a file. +<li><a href=fopen.html>fopen</a> Open a file. +<li><a href=fclose.html>fclose</a> Close a file. +<li><a href=popen.html>popen</a> Open a pipe. +<li><a href=pclose.html>pclose</a> Close a pipe. + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/hex_tab.html b/reference/C/FUNCTIONS/hex_tab.html new file mode 100644 index 0000000..5a9c3d9 --- /dev/null +++ b/reference/C/FUNCTIONS/hex_tab.html @@ -0,0 +1,79 @@ +<title>Hex Ascii table</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> + <HR> +<center> +<h1>Hex Ascii table.</h1> +</center> + <HR> +Here is the Ascii table in base 16. +<p> +<center> +<table border=2 bgcolor="ivory"> +<tr> +<td> +<pre> + 00 01 02 03 04 05 06 07 + 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 + 18 19 1A 1B 1C 1D 1E 1F + 20 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' + 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / + 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 + 38 8 39 9 3A : 3B ; 3C < 3D = 3E > 3F ? + 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G + 48 H 49 I 4A J 4B K 4C L 4D M 4E N 4F O + 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W + 58 X 59 Y 5A Z 5B [ 5C \ 5D ] 5E ^ 5F _ + 60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g + 68 h 69 i 6A j 6B k 6C l 6D m 6E n 6F o + 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w + 78 x 79 y 7A z 7B { 7C | 7D } 7E ~ 7F +</pre> +</td> +</tr> +</table> +</center> +<p> +<dl compact> +<dt><img src=../../GRAPHICS/whiteball.gif> The <a href=dec_tab.html>decimal</a> table is here.<p> +<p> + +<dt><img src=../../GRAPHICS/computer.gif align=center><a href="../PROBLEMS/ascii2.c"> A program</a> to generate this table. +<p> + +<dt><img src=../../GRAPHICS/whiteball.gif><a href="../MISC/numconv.html"> Conversion between Dec,Hec,Binary</a> +<p> +</dl> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/kill.html b/reference/C/FUNCTIONS/kill.html new file mode 100644 index 0000000..3c280ce --- /dev/null +++ b/reference/C/FUNCTIONS/kill.html @@ -0,0 +1,64 @@ +<title>kill function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>kill function </h1> +</center> +<hr> +<b>kill</b> +<p> +<hr> +<pre> + Library: signal.h + + Prototype: int kill(Pitd_t Pid, int Signal); + + Syntax: + + +</pre> +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif><a href="../EXAMPLES/kill.c"> example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="malloc.html">malloc</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/malloc.html b/reference/C/FUNCTIONS/malloc.html new file mode 100644 index 0000000..d4f7e0f --- /dev/null +++ b/reference/C/FUNCTIONS/malloc.html @@ -0,0 +1,123 @@ +<title>malloc function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>malloc function </h1> +</center> +<hr> +<b>malloc</b> (memory allocation) is used to dynamically allocate memory +at run time. Possible uses for this function are: + +<ul> +<li>Read records of an unknown length. +<li>Read an unknown number of database records. +<li><a href="../MISC/linklists.html">Link lists</a>. +</ul> + +The simplest way to reserve memory is to code something like: +<p> +<table border=2 width=100% bgcolor=ivory> +<tr> +<td> +<pre> + + main() + { + char string[1000]; + + <a href="strcpy.html">strcpy</a> (string, "Some text"); + } +</pre> +</tr> +</td> +</table> +<p> +The example above has two problems: +<ul> +<li>If the data is less than + +1000 bytes we are wasting memory. +<li>If the data is greater than 1000 bytes the program is going to crash. +<li>The 1000 bytes are reserved throught out the life of the program. +If this was a long running program that rarely used the memory, it would +again be wasteful. +</ul> +malloc allows us to allocate exactly the correct amount of memory and +with the use of <a href="free.html">free</a> only for the time it is required. +<p> +<hr> +<pre> + Library: stdlib.h + + Prototype: void *malloc(size_t size); + + Syntax: char * String; + + String = (char *) malloc(1000); +</pre> +<hr> +<p> +Looking at the example syntax above, 1000 bytes are reserved and the pointer +<b>String</b> points to the first byte. The 1000 bytes are NOT initialized +by malloc. If the memory is NOT available, a +<a href="../SYNTAX/null.html">NULL</a> pointer is returned. + +Please note, the cast <a href="../CONCEPT/cast.html">cast</a> is required to +return a pointer of the correct type. +<h2>Examples:</h2> + +<img src="../../GRAPHICS/computer.gif"><a href="../EXAMPLES/linklst1.c"> example</a> +program. + +<p> +<hr> +<h2>See Also:</h2> +<img src=../../GRAPHICS/whiteball.gif> +<a href="../CONCEPT/data_types.html#char">char</a> data type.<p> +<img src=../../GRAPHICS/whiteball.gif> +<a href="free.html">free</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="../SYNTAX/sizeof.html">sizeof</a> operator.<p> +<hr> +<font color=brown> +<h2>C++</h2> +<img src=../../GRAPHICS/whiteball.gif> +<a href="../../CPLUSPLUS/SYNTAX/new.html">new</a> is the C++ equivalent to malloc.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="../../CPLUSPLUS/SYNTAX/delete.html">delete</a> is the C++ equivalent to +<a href="free.html">free</a>.<p> +</font> + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/memcpy.htm b/reference/C/FUNCTIONS/memcpy.htm new file mode 100644 index 0000000..d2dafe8 --- /dev/null +++ b/reference/C/FUNCTIONS/memcpy.htm @@ -0,0 +1,118 @@ +<title>memcpy function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>memcpy function</h1> +</center> +<hr> +<p> +<b>memcpy</b> copies data between two memory locations. This function will copy the +supplied number of bytes +stored at the location pointed to by 's2' to the location pointed to by 's1'. + +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr><td> +<pre> + + s1 s2 + | | + V V + - - - - --------------- + | | | | | | a | b | c | d | + - - - - --------------- + ^ ^ | | + | | | | + -|------------- | + ------------------ +</pre> +</td></tr> +</table> +</center> +<p> +<hr> + +<h2>Prototype</h2> + +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr><td> +<pre> + Library: string.h + + Prototype: char memcpy(void *s1, void *s2, int num); + + Syntax: + float data1; + char data2[64]; + + memcpy(data1, data2, sizeof(data2)); +</pre> +</td></tr></table></center><p> +<hr> + +<h2>Notes</h2> + +This is a handy function for moving data between data types + +<h2>See also:</h2> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="strtok.html>strtok"</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="strncpy.html">strncpy</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="strcpy.html">strcpy</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="sprintf.html">sprintf</a> +<br> + +<img src="../../GRAPHICS/man.gif"> +<a href="../MAN/strcat.htm"><i>strcat</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="../CONCEPT/string.html">strings</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="../FUNCTIONS/memcpy.htm">memcpy</a> Copy data from one memory location to another. + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/open.html b/reference/C/FUNCTIONS/open.html new file mode 100644 index 0000000..5c785f8 --- /dev/null +++ b/reference/C/FUNCTIONS/open.html @@ -0,0 +1,86 @@ +<title>open function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>open function </h1> +</center> +<hr> +<b>open</b> +<p> +<hr> +<pre> + Library: unistd.h + sys/types.h + sys/stat.h + fcntl.h + + Prototype: int open(char *Path, int Flags); + + Syntax: int fd; + char *Path="/tmp/file"; + int Flags= O_WRONLY; + + fd = open(Path, Flags); + +</pre> +<hr> +<p> +<b>Flags</b> specify the file attributes. They must contain one of +O_RDONLY, O_WRONLY or O_RDWR and may also have any of the following. +O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, O_NONBLOCK, O_NDELAY, +O_SYNC. See the man page for full details. + +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif><a href="../EXAMPLES/pipe1.c"> pipe example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="pipe.html">pipe</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="close.html">close</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="write.html">write</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="fopen.html">fopen</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/passwd.html b/reference/C/FUNCTIONS/passwd.html new file mode 100644 index 0000000..b0db88b --- /dev/null +++ b/reference/C/FUNCTIONS/passwd.html @@ -0,0 +1,92 @@ +<title>Password file functions.</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>Password file functions.</h1> +</center> +<hr> +<p> +Various functions to extract information from the /etc/passwd file. +This will not work on DOS machines. +<p> + +<hr> +<h2>man pages. </h2> +Some of these links may not work as your system may not support +all the functions. +<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/getpwnam.htm">getpwuid</a> +<i>Get a record by keying on the UID (numeric).</i> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/getpwnam.htm">getpwnam</a> +<i>Get a record by keying on the user name.</i> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/fgetpwent.htm">fgetpwent</a> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/getpwent.htm">getpwent</a> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/getpwent.htm">setpwent</a> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/getpwent.htm">endpwent</a> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/getpw.htm">getpw</a> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/putpwent.htm">putpwent</a> +<p> + +<hr> +<h2>Some notes</h2> + +<hr> +<img src=../../GRAPHICS/computer.gif align=center> +<a href="../EXAMPLES/user_name.c">Example program.</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/pclose.html b/reference/C/FUNCTIONS/pclose.html new file mode 100644 index 0000000..48f9694 --- /dev/null +++ b/reference/C/FUNCTIONS/pclose.html @@ -0,0 +1,68 @@ +<title>pclose function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center><h1>pclose function</h1></center> +<hr> +<p> +<b>pclose</b> is used to close a pipe created with +<a href=popen.html>popen</a>.<p> + +<pre> +Library: stdio.h + +Prototype: int pclose( FILE *stream); + +Syntax: FILE *fp; + pclose(fp); + +</pre> +<hr> +<h2>Example:</h2> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/popen.c"> +example program.</a><p> +<hr> +<h2>See Also:</h2> +<ul> +<li><a href="fgetc.html"> fgetc</a> Get a character from a file. +<li><a href="fputc.html"> fputc</a> Put a character into a file. +<li><a href="fprintf.html">fprintf</a> Put a formatted line into a file. +<li><a href="fopen.html"> fopen</a> Open a file. +<li><a href="popen.html"> popen</a> Open a pipe. +<li><a href="fclose.html"> fopen</a> Close a file. +<li><a href="system.html"> system</a> Issue a system command. +</ul> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/pipe.html b/reference/C/FUNCTIONS/pipe.html new file mode 100644 index 0000000..5f2682c --- /dev/null +++ b/reference/C/FUNCTIONS/pipe.html @@ -0,0 +1,100 @@ +<title>pipe function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>pipe function </h1> +</center> +<hr> +<p> +<b>pipe</b> creates two file descriptors which can be used by +parent and child processes to communicate data. A child process can +be created with the <a href="fork.html">fork</a> function. +<p> +<hr> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr> +<td width="80%"> +<pre> + + Library: unistd.h + + Prototype: int pipe(int fd[2]); + + Syntax: int fd[2]; + pipe(fd); +</pre> +</td> +</tr> +</table> +</center> +<p> +<hr> +On error, pipe returns -1.<p> +Once the pipe has been executed, the data can be transfered +using <a href=read.html>read</a> and +<a href=write.html>write</a>. +<hr> +<h2>Notes:</h2> +Make sure that when you <a href=read.html>read</a> +exactly the same number of bytes that are +<a href=write.html>written</a>! I spend HOURS +trying to figure out why I was loosing data because of this feature!! +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/pipe1.c"> read and write fixed length records.</a> +<p> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/pipe2.c"> read and write variable length records.</a> + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="fork.html">fork</a> <p> +<img src=../../GRAPHICS/whiteball.gif> +<a href="popen.html">popen</a> function.<p> +<img src=../../GRAPHICS/whiteball.gif> +<a href="pclose.html">pclose</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="read.html">read</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="write.html">write</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/popen.html b/reference/C/FUNCTIONS/popen.html new file mode 100644 index 0000000..ac93bec --- /dev/null +++ b/reference/C/FUNCTIONS/popen.html @@ -0,0 +1,88 @@ +<title>popen function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>popen function</h1> +</center> +<hr> +<p> +<b>popen</b> is used to read and write to a unix pipe.<p> This function is NOT +included in 'C Programming Language' (ANSI) but can be found in 'The Standard +C Library' book. + +<pre> +Library: stdio.h + +Prototype: FILE *popen(const char *command, const char *type); + +Syntax: FILE *fp; + fp = popen( "ls -l", "r"); + +Notes: + command - is the command to be issued. + type - r - read O/P from command. + - w - Write data as I/P to command. + +</pre> +<hr> +<h2>Examples:</h2> +<img src=../../GRAPHICS/computer.gif></a> +<a href=../EXAMPLES/popen.c> example program.</a><p> + +<hr> +<h2>Notes:</h2> +<ul> +<li>popen will always execute the command from within the Bourne shell. +<li>popen feeds the STDOUT back to your program. If you want STDERR, +the following will do the trick. +<pre> + fp=popen("ls -l 2>&1", "w"); + AAAA + |||| +</pre> +</ul> +<hr> +<h2>See Also:</h2> +<ul> +<li><a href=fgetc.html>fgetc</a> Get a character from a file. +<li><a href=files.html>fputc</a> Put a character into a file.<i>man pages</i> +<li><a href=fprintf.html>fprintf</a> Put a formatted line into a file. +<li><a href=fopen.html>fopen</a> Open a file. +<li><a href=fclose.html>fclose</a> Close a file. +<li><a href=pclose.html>pclose</a> Close a pipe. +<li><a href=system.html>system</a> Open a pipe. +</ul> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/printf.html b/reference/C/FUNCTIONS/printf.html new file mode 100644 index 0000000..111a8e7 --- /dev/null +++ b/reference/C/FUNCTIONS/printf.html @@ -0,0 +1,106 @@ +<title>printf function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>printf function</h1> +</center> +<hr> +<p> +<b>printf</b> is used to O/P data to +<a href="../MISC/stdfiles.html">STDOUT</a> (usually the screen). It has many +formatting options which we shall look at in a moment. + +<hr> +<h2>printf syntax</h2> +This is an example of <b>printf</b> in its simplest form. +<p> +<center> +<table border=2 bgcolor=ivory> +<tr> +<td> +<pre> + + #include <stdio.h> + + main() + { + printf("This text will appear on the screen\n"); + } +</pre> +</td> +</tr> +</table> +</center> +<p> +printf is passed one formatting argument. +The unusual thing about the example (in my mind) is <b>\n</b>, this is actually +an <a href="escape.html"> escape sequence</a> that signals a new line. Without +it, any printf's +that follow would O/P to the same line. +<b>printf</b> also takes extra arguments which are inserted into the format +string at locations marked with a <b>%</b>. +<p> +<center> +<table border=2 bgcolor=ivory> +<tr> +<td> +<pre> + + #include <stdio.h> + + main() + { + int number=42; + printf("The answer is %i\n", number); + } +</pre> +</td> +</tr> +</table> +</center> +<p> +What happens here is the <b>%i</b> is seen as a +<a href="format.html">formatting identifer</a> for the +next argument (number). In this case an integer is expected.<p> + +<hr> +<h2>See also</h2> +<ol> +<li><a href="puts.html">puts</a> Much easier to use - but not as powerfull. +<li><a href="sprintf.html">sprintf</a> Same as 'printf' but O/P to a string array. +<li><a href="../CONCEPT/string.html">Strings</a>. +<li><a href="../SYNTAX/idioms.html#printf">A dead handy printf idiom.</a>. +</ol> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/puts.html b/reference/C/FUNCTIONS/puts.html new file mode 100644 index 0000000..1e31e79 --- /dev/null +++ b/reference/C/FUNCTIONS/puts.html @@ -0,0 +1,46 @@ +<title>puts function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>puts function </h1> +</center> +<hr> +<p> +<b>puts</b> is used to print data on the screen (or to a file). +Another related +function is <a href=printf.html>printf</a> which is much more powerfull. +<p> +Anyway here is an <a href=../EXAMPLES/first.c>example</a> of the puts function. + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/qsort.html b/reference/C/FUNCTIONS/qsort.html new file mode 100644 index 0000000..466cd4e --- /dev/null +++ b/reference/C/FUNCTIONS/qsort.html @@ -0,0 +1,100 @@ +<title>qsort function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<center> +<hr> +<h1>qsort function</h1> +<hr> +</center> +<p> +<b>qsort</b> will sort an array of elements. This is a wild function that +uses a pointer to another function that performs +the required comparisons. + +<pre> +Library: stdlib.h + +Prototype: void qsort(void *base, + size_t num, + size_t size, + int (*comp_func)(const void *, const void *)) + +</pre> +<hr> +<h2>Some explanation.</h2> +<ul> +<li><pre>void * base</pre> Is a pointer to the array to be sorted. This can +be a pointer to any <a href=../CONCEPT/data_types.html>datatype</a>. +<p> +<li><pre>size_t num</pre> The number of elements. +<p> +<li><pre>size_t size</pre> The element size. +<p> +<li><pre>int (*comp_func)(const void *, const void *))</pre> This is a +pointer to +a function. +</ul> + + +<hr> +<h2>Notes</h2> +<ol> +<li>Well... This caused me alot of trouble! Although the prototype above is +exactly as shown in the documentation, the last parm kept giving compiler +warnings (invalid pointer type) this is the fix. +<pre> + +Prototype: void qsort(void *base, + size_t num, + size_t size, + (void *) (*comp_func)(const void *, const void *)) +</pre> +does anyone know the answer to this problem?? +<p> +<li>I think <a href=../CONCEPT/pointers.html#void>void *</a> needs an explanation. +<p> +<li>And <a href=../CONCEPT/cast.html>cast</a> aswell +<p> +</ol> +<hr> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/qsort1.c>Example program 1</a> As basic as I can make it.<p> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/qsort2.c>Example program</a> with user input.<p> + +<img src=../../GRAPHICS/computer.gif> +<a href=../CONTRIB/OR_USING_C/14.2.c>O'Reilly 'Using C' example.</a><p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/rand.html b/reference/C/FUNCTIONS/rand.html new file mode 100644 index 0000000..afbba99 --- /dev/null +++ b/reference/C/FUNCTIONS/rand.html @@ -0,0 +1,73 @@ +<title>rand function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<h1>rand function </h1> +<b>rand</b> will generate a random number between 0 and 'RAND_MAX' +(at least 32767). + +<pre> +Library: stdlib.h + +Prototype: int rand(void); + +Syntax: int r; /* Random number */ + + r = rand(); +</pre> + +<hr> +<h2>Notes</h2> +<ul> +<li> +Rand will always produce the same sequence of numbers unless +<a href=srand.html>srand</a> is called to seed the start point. +<li> +RAND_MAX is only defined in ANSII header files. +<li>A non standard function <b>random</b> is available on the Sun. +</ul> +<hr> +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/rand.c>example program.</a><p> + +<hr> +<h2>See also:</h2> <p> + +<dl compact> +<dt><img src=../../GRAPHICS/whiteball.gif> +<dd><a href=srand.html>srand</a> Seed the randon number generator. + +<dt><img src=../../GRAPHICS/man.gif> +<dd><a href=../MAN/rand.htm>rand man page.</a> +</dl> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/read.html b/reference/C/FUNCTIONS/read.html new file mode 100644 index 0000000..c4541bb --- /dev/null +++ b/reference/C/FUNCTIONS/read.html @@ -0,0 +1,75 @@ +<title>read function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>read function </h1> +</center> +<hr> +<b>read</b> +<p> +<hr> +<pre> + Library: unistd.h + sys/types.h + + Prototype: int read(int fd, char *Buff, int NumBytes); + + Syntax: int fd; + char Buff[50]; + + read(fd, Buff, sizeof(Buff)); + +</pre> +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif><a href="../EXAMPLES/pipe1.c"> pipe example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="pipe.html">pipe</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="open.html">open</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="close.html">close</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="write.html">write</a> function.<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/setuid.html b/reference/C/FUNCTIONS/setuid.html new file mode 100644 index 0000000..423ceeb --- /dev/null +++ b/reference/C/FUNCTIONS/setuid.html @@ -0,0 +1,102 @@ +<title>User ID.</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<h1>User ID.</h1> + +Various functions to change and see a User or Group ID. These are NOT +ANSII standard functions. Do not expect them all to work on your machine.... +<p> +<hr> +<h2>Man pages. </h2> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/getuid.htm>getuid</a> +<i>Get a users real ID.</i> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/getuid.htm>geteuid</a> +<i>Get a users effective ID.</i> +<p> + +<hr> +<p> +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/setuid.htm>setuid</a> +<i>Set real and effective process ID.</i> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/seteuid.htm>seteuid</a> +<i>Set effective process ID.</i> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/setruid.htm>setruid</a> +<i>Set real process ID.</i> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/setgid.htm>setgid</a> +<i>Set real and effective Group ID.</i> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/setegid.htm>setegid</a> +<i>Set effective Group ID.</i> +<p> + +<hr> +<img src=../../GRAPHICS/man.gif> +setreuid +Seems to have different uses on Sun and RS/6000. +<p> + +<img src=../../GRAPHICS/whiteball.gif> +setuidx +RS/6000 (AIX only). +<p> + +<img src=../../GRAPHICS/whiteball.gif> +getuidx +RS/6000 (AIX only). +<p> + +<hr> +<h2>Some notes</h2> + +<hr> +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/setuid.c>Example program.</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/sprintf.html b/reference/C/FUNCTIONS/sprintf.html new file mode 100644 index 0000000..362818c --- /dev/null +++ b/reference/C/FUNCTIONS/sprintf.html @@ -0,0 +1,61 @@ +<title>sprintf function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>sprintf function</h1> +</center> +<hr> +<b>sprintf</b> is used to format data and put it into a string array. It +is basically a <a href="printf.html">printf</a> and so uses the same +<a href="escape.html"> escape sequences</a> and <a href="format.html">format +identifers.</a><p> + +<a href="../EXAMPLES/sprintf.c"><img src="../../GRAPHICS/computer.gif"></a> +example program.<p> + +<hr> +<h1>See also</h1> +<a href="fprintf.html">fprintf</a> which will O/P formatted text to a file. +<p> +<a href="printf.html">printf</a> O/P formatted text to STDOUT. +<p> +<a href="puts.html">puts</a> O/P text to STDOUT. +<p> +<a href="strcpy.html">strcpy</a> Copy strings. +<p> +<a href="../MAN/strcat.htm"> +<i>strcat</a> Concatinate strings. MAN PAGE.</i> +<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/srand.html b/reference/C/FUNCTIONS/srand.html new file mode 100644 index 0000000..f0d42ee --- /dev/null +++ b/reference/C/FUNCTIONS/srand.html @@ -0,0 +1,73 @@ +<title>srand function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>srand function </h1> +</center> +<hr> +<p> + +<b>srand</b> seeds the random number generation function +<a href=rand.html>rand</a> +so it does not produce the same sequence of numbers. +<pre> +Library: stdlib.h + +Prototype: void srand(unsigned int seed); + +Syntax: unsigned int seed=10; /* seed value */ + + srand(); +</pre> + +<hr> +<h2>Notes</h2> +<ul> +<li> +Obviously the seed has to change every time the program is run. +One way to do this is to feed it the O/P from <a href=time.html>time</a> +</ul> +<hr> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/rand.c>example program.</a> +<p> + +<hr> +See also: <p> +<dt><a href=rand.html>rand</a> Generate a randon number generator. +<dt><a href=time.html>time</a> get the calender time (Number of seconds +since 1st Jan 1970. + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/sscanf.html b/reference/C/FUNCTIONS/sscanf.html new file mode 100644 index 0000000..dc0934b --- /dev/null +++ b/reference/C/FUNCTIONS/sscanf.html @@ -0,0 +1,66 @@ +<title>sscanf function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>sscanf function</h1> +</center> +<hr> +<p> +To be done..... +<hr> +<pre> +Library: stdio.h + +Prototype: char sscanf(const char *buff, const char *format, +<a href="../SYNTAX/functions.html#2.7">...</a>); + +<hr> + +<h2>Notes</h2> + +<hr> +<H2>Examples</H2> + +<a href="../EXAMPLES/sscanf.c"><img src="../../GRAPHICS/computer.gif"></a> +example program. +<hr> + +<h2>See also:</h2> + +<img src="../../GRAPHICS/whiteball.gif"> <a href="sprintf.html">sprintf</a> +<bk> +<img src="../../GRAPHICS/whiteball.gif"> <a href="strtok.html">strtok</a> +<bk> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/stat.html b/reference/C/FUNCTIONS/stat.html new file mode 100644 index 0000000..601aeaa --- /dev/null +++ b/reference/C/FUNCTIONS/stat.html @@ -0,0 +1,124 @@ +<title>stat/fstat/lstat functions.</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>stat/fstat/lstat functions.</h1> +</center> +<hr> +<p> + +All three functions return information about a file. Please note +that devices are seen as files to Unix, so you could 'stat' things +like /dev/mouse to see when the mouse was last moved.<p> + +<b>stat</b> return the status of a file.<p> + +<b>fstat</b> stats an open file.<p> + +<b>lstat</b> reports on a link, not the file it points too.<p> +<pre> +Libraries: sys/stat.h + unistd.h + +Syntax: struct stat stat_p; + stat ("martin", &stat_p); + +Stat Structure: + + struct stat + { + dev_t st_dev; /* device */ + ino_t st_ino; /* inode */ + umode_t st_mode; /* protection */ + nlink_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of owner */ + gid_t st_gid; /* group ID of owner */ + dev_t st_rdev; /* device type (if inode device) */ + off_t st_size; /* total size, in bytes */ + unsigned long st_blksize; /* blocksize for filesystem I/O */ + unsigned long st_blocks; /* number of blocks allocated */ + time_t st_atime; /* time of last access */ + time_t st_mtime; /* time of last modification */ + time_t st_ctime; /* time of last change */ + }; + +</pre> + +<b>st_mode</b> can be used with the following macros to discover the +type of file being statted. + +<a name=filetype> +<pre> + S_ISLNK(st_mode) is it a symbolic link + + S_ISREG(st_mode) regular file + + S_ISDIR(st_mode) directory + + S_ISCHR(st_mode) character device + + S_ISBLK(st_mode) block device + + S_ISFIFO(st_mode) fifo + + S_ISSOCK(st_mode) socket +</pre> + +These functions return a large amount of information. See the man page +(below) for details. You will need to understand +<a href="../SYNTAX/struct.html">structures</a> to work with stat.<p> + +<img src=../../GRAPHICS/man.gif> +<a href="../MAN/stat.htm"> +man page to provide all the details.</a> +<p> +<hr> +<h2>Examples</h2> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/stat.c"> +example program.</a> +<p> +<hr> +<h2>See also:</h2> +<img src=../../GRAPHICS/whiteball.gif> +<a href=directory.html>POSIX functions to read directory information.</a> +<p> +<hr> +<h2>Note</h2> +I have seen a problem with the 'access time', it only seems to get updated +if the file system is local. If the filesystem is NFS mounted and +accessed via 'cat' or 'head' the access date is not updated. + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/stdlib.html b/reference/C/FUNCTIONS/stdlib.html new file mode 100644 index 0000000..ec05ac4 --- /dev/null +++ b/reference/C/FUNCTIONS/stdlib.html @@ -0,0 +1,44 @@ + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<h1> +<center>stdlib.h</center> +</h1> +<hr> + +This page is obsolete and has been replaced with +<a href=funcref.htm#stdlib>this new page</a>. + + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> + diff --git a/reference/C/FUNCTIONS/strchr.html b/reference/C/FUNCTIONS/strchr.html new file mode 100644 index 0000000..0d1b39b --- /dev/null +++ b/reference/C/FUNCTIONS/strchr.html @@ -0,0 +1,80 @@ +<title>strchr strrchr functions</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center><h1>strchr strrchr functions</h1></center> +<p> +<hr> +<ul> +<li><b>strchr</b> will find the first matching character in a string.<br> +<p> +<li><b>strrchr</b> will find the last matching character in a string.<p> +</ul> + +The functions will return a pointer to the character or +<a href=../SYNTAX/null.html>NULL</a> if +the character is not found. + +<hr> +<pre> +Library: string.h + +Prototype: char * strchr(const char *string, int character); + +Syntax: int character='w'; + char *string="red dwarf"; + if(strchr(string, character)) puts("Character found"); +</pre> + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href=strstr.html>strstr</a> which looks for a sub-string in a string. +<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href=strpbrk.html>strpbrk</a> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/index.htm>index and rindex</a> do the same as <b>strchr</b> +and <b>strrchr</b> but are non standard. + + +<hr> +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/strchr.c> Example program (from Dave Doolin).</a> <p> + + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strcmp.html b/reference/C/FUNCTIONS/strcmp.html new file mode 100644 index 0000000..003ba5b --- /dev/null +++ b/reference/C/FUNCTIONS/strcmp.html @@ -0,0 +1,88 @@ +<title>strcmp function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>strcmp function</h1> +</center> +<hr> +<p> +<b>strcmp</b> will test two strings for equallity. +<pre> + Returns : + < 0 if s1 is less than s2 + 0 if s1 == s2 + > 0 if s1 is greater than s2 +</pre> +This function probably provides too much information +by indicating which string is lexicographically greater. The net result +means that the <b>strcmp</b> return code is logically incorrect because +it returns a <a href=../CONCEPT/true_false.html>FALSE</a> value +when the strings match. +<p> +<hr> +<h2>Example:</h2> +<img src=../../GRAPHICS/computer.gif alt="o"> +<a href=../EXAMPLES/strcmp.c>Function that compares two strings</a> +and returns a sensible return code. + +<hr> +<h2>See Also:</h2> +<img src=../../GRAPHICS/whiteball.gif alt="o"> +<a href=strncmp.html>strncmp</a> +<p> + +<img src=../../GRAPHICS/whiteball.gif alt="o"> +<a href=strstr.html>strstr</a> Find a sub string in a string. +<p> + +<img src=../../GRAPHICS/whiteball.gif alt="o"> +<a href=strchr.html>strchr</a>Locate a character in a string. +<p> + +<img src=../../GRAPHICS/man.gif alt="o"> +<a href=../MAN/index.htm>index</a> Locate a character in a string. +<p> + +<img src=../../GRAPHICS/man.gif alt="o"> +<a href=../MAN/strcasecmp.htm>strcasecmp</a> Compare strings, ignoring case. +<p> + +<img src=../../GRAPHICS/man.gif alt="o"> +<a href=../MAN/toupper.htm>toupper</a> +<p> + +<img src=../../GRAPHICS/man.gif alt="o"> +<a href=../MAN/toupper.htm>tolower</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strcpy.html b/reference/C/FUNCTIONS/strcpy.html new file mode 100644 index 0000000..2a15dbb --- /dev/null +++ b/reference/C/FUNCTIONS/strcpy.html @@ -0,0 +1,127 @@ +<title>strcpy function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>strcpy function</h1> +</center> +<hr> +<p> +<b>strcpy</b> copies a string. This function will copy the bytes +stored at the location pointed to by 's2' to the location pointed to by 's1'. + +<pre> + + s1 s2 + | | + V V + - - - - - - - -- + | | | | | |a|b|c|\0| + - - - - - - - -- + ^ ^ | | + | | | | + -|------------- | + --------------- +</pre> + +<hr> +<pre> +Library: string.h + +Prototype: char strcpy(char *s1, const char *s2); + +Syntax: + char string2[20]="red dwarf"; + char string1[20]=""; + strcpy(string1, string2); +</pre> + +<hr> + +<h2>Notes</h2> + +Dont forget that strings are terminated with a +'<a href="../SYNTAX/null.html">\0</a>' so allow space for it... +<p> +There is another way to code the example above. Consider this piece of +code. +<pre> + main() + { + char *string2="red dwarf"; + char *string1; + + string1=string2; + } +</pre> + +'string2' is now a character pointer (only one byte) that points to a +storage location containing "red dwarf" (a +<a href="../CONCEPT/constants.html#str">string constant</a>). So +<b>string1=string2;</b> copies the address of "red dwarf" into +'string1'. This version of the code will execute quicker than strcpy +because less data is being moved around the system. + + +<hr> +<img src="../../GRAPHICS/computer.gif"> +<a href="../EXAMPLES/strcpy.c">example program.</a> +<hr> + +<h2>See also:</h2> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="strtok.html">strtok</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="strncpy.html">strncpy</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="sprintf.html">sprintf</a> +<br> + +<img src="../../GRAPHICS/man.gif"> +<a href="../MAN/strcat.htm"><i>strcat</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="../CONCEPT/string.html">strings</a> +<br> + +<img src="../../GRAPHICS/whiteball.gif"> +<a href="memcpy.htm">memcpy</a> Copy data between tow memory locations. +<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strlen.html b/reference/C/FUNCTIONS/strlen.html new file mode 100644 index 0000000..4473955 --- /dev/null +++ b/reference/C/FUNCTIONS/strlen.html @@ -0,0 +1,72 @@ +<title>strlen function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>strlen function </h1> +</center> +<hr> +<p> +<b>strlen</b> will give you the length of a string, NOT including the '\0' +terminator. It should not be confused with the +<a href=../SYNTAX/sizeof.html>sizeof</a> operator +which returns the size of a variable (that could hold a string).<p> + +<pre> +Library: string.h + +Prototype: size_t strlen(const char *s); + +Syntax: size_t size; + char string[20]="red dwarf"; + size = strlen(string); +</pre> + +<hr> +<h2>Examples</h2> +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/reverse.c> Example program.</a> +<hr> +<h2>See Also</h2> +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/strlen.htm> strlen man page.</a> +<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href=../SYNTAX/sizeof.html>sizeof</a> operator. +<p> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/lenstr.c> lenstr - User written version of strlen.</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strncmp.html b/reference/C/FUNCTIONS/strncmp.html new file mode 100644 index 0000000..023b622 --- /dev/null +++ b/reference/C/FUNCTIONS/strncmp.html @@ -0,0 +1,78 @@ +<title>strncmp function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>strncmp function</h1> +</center> +<hr> +<p> +<b>strncmp</b> will test at most 'n' characters in s1 to s2 for equallity. +<pre> +Library: string.h + +Prototype: int strncmp(const char *s1, const char *s2, int n); + +Syntax: char string1[]="red dwarf"; + char string2[]="red"; + + strncmp(string1, string2, 3); +Returns : + < 0 if s1 is less than s2 + 0 if s1 == s2 + > 0 id s1 > s2 +</pre> +Could do with more explanation.... +<hr> +<h2>See Also:</h2> +<img src=../../GRAPHICS/whiteball.gif> +<a href=strcmp.html>strcmp</a> +<p> + +<img src=../../GRAPHICS/man.gif alt="o"> +<a href=../MAN/strcasecmp.htm>strcasecmp</a> Compare strings, ignoring case. +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/toupper.htm>toupper</a> +<p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/toupper.htm>tolower</a> +<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href=../CONCEPT/string.html>Strings</a> +<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strncpy.html b/reference/C/FUNCTIONS/strncpy.html new file mode 100644 index 0000000..19c2ae9 --- /dev/null +++ b/reference/C/FUNCTIONS/strncpy.html @@ -0,0 +1,76 @@ +<title>strncpy function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<center> +<hr> +<h1>strncpy function</h1> +<hr> +</center> +<p> +<b>strncpy</b> copies 'n' bytes from one string to another.<p> + +<pre> +Library: string.h + +Prototype: char strncpy(char s1, const char *s2, size_t n); + +Syntax: size_t n; + char string1[20]="red dwarf"; + char string2[20]="; + strncpy(string2, string1, 4); +</pre> + +<hr> +<h2>Notes</h2> +<ul> +<li>It may be nessacary to add your own +<a href=../SYNTAX/null.html>NULL</a> terminator. +</ul> +<hr> +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/strncpy.c>example program.</a><p> +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/sprintf1.c>An alternative method using 'sprintf'...</a><p> + + +<hr> +<h2>See also:</h2> +<ul> +<li><a href=strcpy.html>strcpy</a> Copy a string. +<li><a href=../MAN/memcpy.htm>memcpy</a> Copy memory. +<li><a href=strtok.html>strtok</a> Get characters upto a seperator. +<li><a href=../MAN/strcasecmp.htm>strcasecmp</a> Compare strings, ignoring case. +<p> +</ul> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strpbrk.html b/reference/C/FUNCTIONS/strpbrk.html new file mode 100644 index 0000000..6e9909b --- /dev/null +++ b/reference/C/FUNCTIONS/strpbrk.html @@ -0,0 +1,75 @@ +<title>strpbrk function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center><h1>strpbrk function</h1></center> +<hr> +<p> +<b>strpbrk</b> locates characters in a string. +<p> + +<hr> +<pre> +Library: string.h + +Prototype: char * strpbrk(const char *string1, const char *string2); + +Syntax: char *ptr; + char string1[]="martin was ere"; + char string2[]="ea"; + + ptr=strpbrk(string1, string2); +</pre> + +In this example <b>ptr</b> will be pointing to the first <b>a</b> +within <b>m</b><i>a</i><b>rtin was ere</b> + + +<hr> +<h2>See Also:</h2> + +<ul> +<li><a href=strchr.html>strchr</a> +</ul> + +<hr> +<h2>Example:</h2> + +<img src=../../GRAPHICS/computer.gif> +<a href=../EXAMPLES/strpbrk.c>Change field seperators to 'blank'.</a><p> + +<img src=../../GRAPHICS/man.gif> +<a href=../MAN/strpbrk.htm> MAN PAGE</a> +<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strstr.html b/reference/C/FUNCTIONS/strstr.html new file mode 100644 index 0000000..4df5542 --- /dev/null +++ b/reference/C/FUNCTIONS/strstr.html @@ -0,0 +1,74 @@ +<title>strstr function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>strstr function </h1> +</center> +<hr> +<p> +<b>strstr</b> will find a sub-string within a string. +See also <a href="strchr.html">strchr</a> which will look for a character in a +string. + +<pre> +Library: string.h + +Prototype: char * strstr(const char *s1, const char *s2); + +Syntax: char string1[]="red dwarf"; + char string2[]="dwarf"; + void *pointer; + pointer = strstr(string1, string2); +</pre> +strstr returns a pointer to the beginning of the sub-string or NULL +if not found. +<hr> +<h2>Example:</h2> + +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/strstr.c"> +example program.</a> + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/man.gif></a> +<a href="../MAN/strstr.htm">strstr</a> man page. +<p> + +<img src=../../GRAPHICS/whiteball.gif></a> +<a href="strchr.html">strchr</a> Find a character in a string. +<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strtok.html b/reference/C/FUNCTIONS/strtok.html new file mode 100644 index 0000000..4d15b2f --- /dev/null +++ b/reference/C/FUNCTIONS/strtok.html @@ -0,0 +1,100 @@ +<title>strncpy function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>strtok function</h1> +</center> +<hr> +<p> +All the books that I have read, say that strtok will break a string +into tokens. This is true, but a more obvious +explanation is, that it will break a string into <b>words</b>. +<p> +<hr> +<pre> + +Library: string.h + +Prototype: char * strtok(char *s, const char *delim); + +Syntax: char string []="abc def ghi"; + char * word; + + word=strtok(string, " "); + word=strtok(NULL, " "); + +</pre> + +<b>strtok</b> requires a string and the word delimiters, for example: + +<pre> + + word = strtok(string, " "); + A A + | | + | ------- Delimiters. + | + -------------- String to break up. + +</pre> +After the first call to strtok, word will point to <b>abc</b> on the second +call, word will point to <b>def</b> +<p> +<hr> +<h2>Notes:</h2> +<ul> +<li>strtok will alter the I/P string by placing +<a href="../SYNTAX/null.html">NULLS</a> at the delimiter +positions. A good habit is to <a href="../FUNCTIONS/strcpy.html">copy</a> +the string to a tempary string +and use the copy in the strtok call. +<p> +<li>More than one delimiter can be specified. So you could code: +<pre> + + word = strtok(string, " <a href="../FUNCTIONS/escape.html">\t</a>;:,"); + +</pre> +<li>You do not have to include \0 or <a href=../SYNTAX/null.html>NULL</a> +</ul> +<hr> +<h2>Examples:</h2> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/strtok.c"> Example program.</a> +<hr> +<h2>See also:</h2> +<dt><a href="strcpy.html">strcpy</a> +<dt><a href="strncpy.html">strncpy</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strtol.html b/reference/C/FUNCTIONS/strtol.html new file mode 100644 index 0000000..1a676fc --- /dev/null +++ b/reference/C/FUNCTIONS/strtol.html @@ -0,0 +1,90 @@ +<title>strtol function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>strtol function </h1> +</center> +<hr> +<p> +<b>strtol</b> will convert a string to a long integer. An important feature +of this function is the ability to accept data in various number bases +and convert to decimal. If +you are just working with decimal numbers, +<a href="atoi.html">atoi</a> is probably an easer function to use. +<p> +<hr> +<pre> + +Library: stdlib.h + +Prototype: long int strtol(const char *sptr, char **endptr, int base); + +Syntax: char String[]="ff"; /* string to convert */ + int Base=16; /* Base 16 */ + long int Ans; /* Result */ + + Ans = strtol(String, NULL, Base); +</pre> + +<hr> +<h2>Notes</h2> +The second argument (char **endptr) seems to be a waste of space! If +it is set to NULL, STRTOL +seems to work its way down the string until it finds an invalid character +and then stops. All valid chars read are then converted if the string +starts with an invalid character the function returns ZERO (0). +<p> +The Third argument (base) can have a value of 0 or 2-32. +<ul> +<li>0 - strtol will attempt to pick the base. Only Dec, Oct Hex supported. +<li>2-31 - The base to use. +</ul> +<hr> +<h2>Examples:</h2> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/strtol.c"> Example program.</a> +<p> +<hr> +<dt><h2>See also:</h2> +<p> +<dt><a href="atoi.html">atoi</a> String to integer conversion. +<dt><a href="atof.html">atof</a> String to floating point conversion. +<dt><a href="atol.html">atol</a> String to long integer conversion. +<dt><a href="../MAN/strtod.htm">strtod</a> String to double conversion. +<dt><a href="strtoul.html">strtoul</a> String to unsigned long integer +conversion. +<dt><a href="../MISC/numconv.html">Conversion table.</a> +<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/strtoul.html b/reference/C/FUNCTIONS/strtoul.html new file mode 100644 index 0000000..c4f3ea3 --- /dev/null +++ b/reference/C/FUNCTIONS/strtoul.html @@ -0,0 +1,99 @@ +<title>strtoul function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>strtoul function </h1> +</center> +<hr> +<p> +<b>strtoul</b> will convert a string to an unsigned long integer. An important +feature +of this function is the ability to accept data in various number bases +and convert to decimal. If +you are just working with decimal numbers, +<a href="atoi.html">atoi</a> is probably an easer function to use. +<hr> +<pre> +Library: stdlib.h + +Prototype: long int strtoul(const char *sptr, char **endptr, int base); + +Syntax: char string1[]="ff"; /* string to convert */ + int base=16; /* Base 16 */ + unsigned long int ans; /* Result */ + + ans = strtoul(string, NULL, 16); +</pre> + +<hr> +<h2>Notes</h2> +The first argument must not contain a + or -.<p> + +The second argument (char **endptr) seems to be a waste of space! If +it is set to NULL, STRTOL +seems to work its way down the string until it finds an invalid character +and then stops. All valid chars read are then converted if the string +starts with an invalid character the function returns ZERO (0). +<p> +The Third argument (base) can have a value of 0 or 2-32. +<ul> +<li>0 - strtol will attempt to pick the base. Only Dec, Oct Hex supported. +<li>2-31 - The base to use. +</ul> +<hr> +<h2>Examples</h2> +<img src=../../GRAPHICS/computer.gif> +<a href="../EXAMPLES/strtol.c"> example program</a> (actually the strtol example, but its near enough).<p> +<hr> +<h2>See also:</h2> +<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="atoi.html">atoi</a> String to integer conversion. +<br> +<img src=../../GRAPHICS/whiteball.gif> +<a href="atof.html">atof</a> String to floating point conversion. +<br> +<img src=../../GRAPHICS/whiteball.gif> +<a href="atol.html">atol</a> String to long integer conversion. +<br> +<img src=../../GRAPHICS/whiteball.gif> +<a href="../MAN/strtod.htm">strtod</a> +String to double conversion. +<br> +<img src=../../GRAPHICS/whiteball.gif> +<a href="strtol.html">strtol</a> String to long integer +conversion. + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/system.html b/reference/C/FUNCTIONS/system.html new file mode 100644 index 0000000..3f508de --- /dev/null +++ b/reference/C/FUNCTIONS/system.html @@ -0,0 +1,67 @@ +<title>system function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<center> +<hr> +<h1>system function</h1> +<hr> +</center> +<p> +The <b>system</b> function is used to issue a command. +Execution of your program will not continue until the command has completed. +<p> + +<pre> +Library: stdlib.h + +Prototype: int system(const char *cmd); + +Syntax: system( "cat /etc/hosts"); + +Notes: + In Unix systems, the command is passed to "/bin/sh -c" for + execution. I do not know what handles the command in DOS systems. + +</pre> +<img src="../../GRAPHICS/computer.gif"align=center> +<a href="../EXAMPLES/system.c"> example program.</a> +<p> +<hr> +<h2>See Also:</h2> +<ul> +<li><a href="popen.html">popen</a> Open a pipe. +<li><a href="pclose.html">pclose</a> Close a pipe. +</ul> +<p> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/time.html b/reference/C/FUNCTIONS/time.html new file mode 100644 index 0000000..82d00f3 --- /dev/null +++ b/reference/C/FUNCTIONS/time.html @@ -0,0 +1,86 @@ +<title>time and date related functions</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor="#ffffcc"> +<hr> +<center> +<h1>time and date related functions.</h1> +</center> +<hr> +<p> +The following information gives a taste of the date and time related functions. +It stikes me that this is overly complicated, but what do I know... +To review all the functions available in the standard library, +<a href="funcref.htm#time">click here</a>. +<p> +<center> +<table border=2 bgcolor="ivory"> +<tr> +<td> +<pre> + + Library: time.h + + Prototype: char *asctime( const struct tm *time); + char *ctime(const time_t *timer); + struct tm *localtime(const time_t *timer); + size_t strftime(char *s, + size_t maxsize, + const *format, + const struct tm *time); + + Syntax: + +</pre> +</td> +</tr> +</table> +</center> +<p> +The prototype list does NOT list all the functions that are +described in time.h - only the ones I have used and shown in the +example that follows.<p> + +<img src="../../GRAPHICS/computer.gif"> +<a href="../EXAMPLES/time.c">Example program.</a> +<p> +<img src=../../GRAPHICS/whiteball.gif> +<a href=../PROBLEMS/problems.html#yesterday>Here is a time related problem.</a> +<p> +<hr> +<h2>See also:</h2> +<ul> +<li><a href=funcref.htm#time>time.h</a> standard library. +</ul> + + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/uname.html b/reference/C/FUNCTIONS/uname.html new file mode 100644 index 0000000..8a3eba4 --- /dev/null +++ b/reference/C/FUNCTIONS/uname.html @@ -0,0 +1,59 @@ +<title>uname function.</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<h1>uname function.</h1> + +uname is NOT in the ANSII library but is handy for getting +system information. It will return handy things like: +<p> +System type (name).<p> +Host name (Nodename).<p> +Software release.<p> +Software date.<p> +Machine type.<p> +Domainname. <p> + +<hr> +<h2>man pages. </h2> + +<a href=../MAN/uname.htm>uname</a> +<i>man Page.</i> +<p> +<a href=../MAN/gethostname.htm>gethostname</a> +<i>man Page.</i> +<p> + +<hr> +<a href=../EXAMPLES/uname.c>Example program.</a> + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> diff --git a/reference/C/FUNCTIONS/write.html b/reference/C/FUNCTIONS/write.html new file mode 100644 index 0000000..f3957ed --- /dev/null +++ b/reference/C/FUNCTIONS/write.html @@ -0,0 +1,78 @@ +<title>write function</title> + +<head> +<script language="JavaScript"> +</script> +</head> + +<body bgcolor=#ffffcc> +<hr> +<center> +<h1>write function </h1> +</center> +<hr> +<b>write</b> +<p> +<hr> +<pre> + Library: unistd.h + sys/types.h + + Prototype: int write(int fd, char *Buff, int NumBytes); + + Syntax: int fd; + char Buff[]="V8 cars are coool"; + + write(fd, Buff, strlen(Buff)+1); + +</pre> +<hr> +<h2>Examples:</h2> + +<img src=../../GRAPHICS/computer.gif><a href="../EXAMPLES/pipe1.c"> pipe example</a> +program. + +<hr> +<h2>See Also:</h2> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="pipe.html">pipe</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="open.html">open</a> function.<p> + +<img src=../../GRAPHICS/whiteball.gif> +<a href="close.html">close</a> function.<p> + + + +<img src=../../GRAPHICS/whiteball.gif> +<a href="read.html">read</a> function.<p> + + + +<p> + +<hr> +<p> +<center> +<table border=2 width="80%" bgcolor="ivory"> +<tr align=center> +<td width="25%"> +<a href="../cref.html"> Top</a> +</td><td width="25%"> +<a href="../master_index.html"> Master Index</a> +</td><td width="25%"> +<a href="../SYNTAX/keywords.html"> Keywords</a> +</td><td width="25%"> +<a href="funcref.htm"> Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address>Martin Leslie +</address><p> +</body> +</html> |