
/**************************************************************************
 *                                                                        *
 * Copyright (c) 1996 Michael Richmond and Richard Treffers               *
 *                                                                        *
 *                    This software may be copied and distributed for     *
 *                    educational, research and not for profit services   *
 *                    provided that this copyright and statement are      *
 *                    included in all such copies.                        *
 *                                                                        *
 **************************************************************************/


/* 
	returns value in specified column 
*/

#include <stdlib.h>
#include <math.h>
#include "pcvista.h"

double 
get_col(buf, col)
char *buf;
int col;
{
	int i = 0;

	while (--col) {
		while ((buf[i] == ' ') || (buf[i] == '\t')) {	/*skip leading blanks */
			i++;		
			if (buf[i] == '\0')		
				error(-1, "column not found");
		}
		while ((buf[i] != ' ') && (buf[i] != '\t')) { /*find next whitespace */
			i++;		
			if (buf[i] == '\0')		
				error(-1, "column not found");
		}
	}
	return(atof(&buf[i]));
}
