> BHP 7/29/95 18.65 18.50 18.70 123456
> That is: Stock symbol, date (M/DD/YY or YYMMDD the former is probably
> preferable), High, Low, Close, Volume.
The latter is easier for me, so I will use it unless you can't
handle it, in which case I'll change the program for you.
Are you sure it's YYMMDD with no intervening "/"? Here's the
program you need anyway. Let me know if you have any problems,
or you want me to make the format MM/DD/YY. It is simple to do,
it's just I'd prefer not to tarnish my hard disk with American
date formats if at all possible.
You will need to compile it yourself, or FREQ a copy from me, as
I'll compile it under MSDOS and make it available in my "MONEY"
area. It will compile on any ISO-conforming C compiler. EMX 0.9a
is a free compiler available for DOS and OS/2.
/*********************************************************************/
/* */
/* This Program Written by Paul Edwards, 3:711/934{at}fidonet. */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* aus2met - convert stock data (my format) into metastock text. */
/* */
/* Example of use: */
/* austmet outfile */
/* */
/* */
/* My format is */
/* */
/* 951002|AAA|2.56|2.55|2.55|27200 */
/* */
/* Metastock format is */
/* */
/* AAA 951002 2.56 2.55 2.55 27200 */
/* */
/* both are high, low, close and volume figures. */
/* */
/*********************************************************************/
#include
#include
static char buf[200];
static char *p1;
static char *p2;
static char *p3;
static char *p4;
static char *p5;
static char *p6;
int main(void)
{
while (fgets(buf, sizeof buf, stdin) != NULL)
{
p1 = strtok(buf, "|");
p2 = strtok(NULL, "|");
p3 = strtok(NULL, "|");
p4 = strtok(NULL, "|");
p5 = strtok(NULL, "|");
p6 = strtok(NULL, "|\n");
printf("%s %s %s %s %s %s\n", p2, p1, p3, p4, p5, p6);
}
return (0);
}
@EOT:
---
* Origin: X (3:711/934.9)
|