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

Re: [amibroker] AFL - FIle handling



PureBytes Links

Trading Reference Links




Ara,
 
FPUTS needs a FILE HANDLE 
Check out the guide:<A 
href="">http://www.amibroker.com/guide/afl/afl_view.php?name=FPUTS
 

<SPAN lang=EN-US 
>// 
Test File Handling<SPAN lang=EN-US 
><?xml:namespace 
prefix = o ns = "urn:schemas-microsoft-com:office:office" 
/>
<SPAN lang=EN-US 
>// 
Create text file and save all trade signals<SPAN lang=EN-US 
>
<SPAN lang=EN-US 
>fh 
= <SPAN lang=EN-US 
>fopen<SPAN 
lang=EN-US 
>(<SPAN 
lang=EN-US 
>"afl\\tradesignals.txt"<SPAN 
lang=EN-US 
>,<SPAN 
lang=EN-US 
>"w"<SPAN 
lang=EN-US 
>);
<SPAN lang=EN-US 
>"fh1<SPAN 
>  "<SPAN lang=EN-US 
> 
+ <SPAN lang=EN-US 
>WriteVal<SPAN 
lang=EN-US 
>(fh);
<SPAN lang=EN-US 
> 
<B 
><SPAN lang=EN-US 
>if<SPAN 
lang=EN-US 
> 
(fh)
<SPAN lang=EN-US 
>{
<SPAN lang=EN-US 
>fputs<SPAN 
lang=EN-US 
>(<SPAN 
lang=EN-US 
>LastValue<SPAN 
lang=EN-US 
>(<B 
>Close),fh); //<--- SECOND ARGUMENT 
IN FPUTS NEEDS TO BE FILE HANDLE
<SPAN lang=EN-US 
>fclose<SPAN 
lang=EN-US 
>(fh);
<SPAN lang=EN-US 
>printf<SPAN 
lang=EN-US 
>(<SPAN 
lang=EN-US 
>"file 
opened OK"<SPAN lang=EN-US 
>); 

<SPAN lang=EN-US 
>}
<B 
><SPAN lang=EN-US 
>else<SPAN 
lang=EN-US 
>
<SPAN lang=EN-US 
>{
<SPAN lang=EN-US 
>"fh2<SPAN 
>  "<SPAN lang=EN-US 
> 
+ <SPAN lang=EN-US 
>WriteVal<SPAN 
lang=EN-US 
>(fh);
<SPAN lang=EN-US 
>printf<SPAN 
lang=EN-US 
>(<SPAN 
lang=EN-US 
>"Error 
opening file"<SPAN lang=EN-US 
>); 
<SPAN lang=EN-US 
>} 

 
Hope this helps.
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Ara Kaloustian 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">Ami-Main 
  Sent: Monday, December 08, 2003 5:18 
  AM
  Subject: [amibroker] AFL - FIle 
  handling
  
  I am trying to do some file operations .... 
  create file, open file, write data.
   
  The code attached (Word file) does not compile 
  ... error message shown .... File does get created, file handle value is 
  0(zero) and can not open file to write.
   
  The else part of the if () statement 
  executes
   
  Appreciate any feedback.
   
  AraSend 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.