[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Code needed - fopen fget - use csv file as input ?



PureBytes Links

Trading Reference Links

Ok - here is what I have but can't quite get it to work.
I have the code to fget and the code that I want to replace.
How do I put a loop inside the "New Method" to fget to read the csv file in place of each "OR" I have in the "Old Method"?

****New Method****
_SECTION_BEGIN("ReadingCSV");
Title = "Reading CSV";
fh = fopen("C:\\AmiBroker CSV\\ABTest.csv","r");
if (fh)
{
while(!feof(fh))
   { 
Numbers = fgets( fh ); // What I need to do is use this list to slim down the IndustryID to be used
//IndustryID() == Numbers; // This might work, but how to implement ?
   } 
}
else 
{ 
   printf("ERROR: file can not be found (does not exist)");
}
fclose(fh);
_SECTION_END();


**** Old method ****
if ( RIDon == 1 ) // RIDon is restrict to these Industrys
    Filter = Filter AND ( 
                 IndustryID() == 2
                 OR IndustryID() == 3
                 OR IndustryID() == 4
                 OR IndustryID() == 5
                 OR IndustryID() == 7
                 OR IndustryID() == 15
             		);

> > Does anyone have simple snippet of code that takes a csv file (could be
> > comma delimited or carrage returned) that then can be the input for going
> > through a list.
> >
> > Example: text.csv contains a list of numbers that would be used to
> > "restrict" or "slim down" the IndustryID that is being used for a "display"
> > or "explore".
> >
> > Thanks
> >



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/