The format specifications should be in the MSDN section of support.microsoft.com under printf or format specifications or %f, %g, etc. Somewhere in that area there is a table in which all is revealed.
----- Original Message ----- From: "Lester Vanhoff" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, June 12, 2006 7:28 AM Subject: [amibroker] Re: How To Get Two Digit Year In Exploration > > y = Year()%100; > > Thanks a lot, Graham, that's the key, it solved the problem. Can anyone > suggest a link with some info about "c" string formatting (all those %f, > %e, %g, %100, etc.) > > I have another question but I'll start another thread: > > "How to overwrite exported CSV data file" > > Lester > > >>Graham <[EMAIL PROTECTED]> wrote: >> >> y = Year()%100; >> >> ds = StrFormat( "%02.f%02.f%02.f,", y[i], m[i], d[i] ); // date string >> >> >> On 12/06/06, Lester Vanhoff <[EMAIL PROTECTED]> wrote: >> > > Graham> If you are wanting to export the data so you can use it in >> > > another package then use the export AFL rather than explorations. >> > >> > That's how I started but I couldn't figure out "c" code to get two >> > digit year so I decided to try explorations first. Here is the looping >> > code that generates the required data file (C:\Test\Ms_eod.csv) with >> > four digit year. The question is how to change the following line to >> > get yymmdd instead of yyyymmdd: >> > >> > ds = StrFormat( "%4.f%02.f%02.f,", y[i], m[i], d[i] ); >> > >> > I tried these two options but both still give four digit year: >> > >> > ds = StrFormat( "%02.f%02.f%02.f,", y[i], m[i], d[i] ); >> > ds = StrFormat( "%2.f%02.f%02.f,", y[i], m[i], d[i] ); >> > >> > Here is the full code: >> > >> > /****START****/ >> > >> > folder = "C:\\Test"; >> > fmkdir( folder ); // this automatically creates the directory >> > >> > fh = fopen( folder + "\\" + "Ms_eod.csv", "a"); >> > >> > if (fh) >> > { >> > t = Name(); >> > p = "D"; >> > y = Year(); >> > m = Month(); >> > d = Day(); >> > for( i = 0; i < BarCount; i++ ) // loop >> > { >> > fputs( t + "," , fh ); >> > fputs( p + "," , fh ); >> > ds = StrFormat( "%4.f%02.f%02.f,", y[i], m[i], d[i] ); // date string >> > fputs( ds, fh ); >> > qs = StrFormat("%.4f, %.4f, %.4f, %.4f, %.0f, %.0f\n", O[i], H[i], >> > L[i], C[i], V[i], OI[i] ); // quote string >> > fputs( qs, fh ); >> > } >> > fclose( fh ); >> > } >> > Buy = 0; // link to "scan" button >> > >> > /****END****/ > > > > > > > > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For other support material please check also: > http://www.amibroker.com/support.html > > > Yahoo! Groups Links > > > > > > > > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 06/09/06 > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Protect your PC from spy ware with award winning anti spy technology. It's free. http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/GHeqlB/TM --------------------------------------------------------------------~-> Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
