Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

How to write data from .txt
 Post subject: How to write data from .txt Post rating: 0   New post Posted: Thu 08 Dec, 2011, 19:42 

User rating: 0
Joined: Sat 06 Aug, 2011, 23:17
Posts: 27
Location: Russian Federation,
Hellow eweryone. How to write data from .txt ?

For ex. , i need to write data from C:/time/info.txt . How to do this?

Thanks for help!


 
 Post subject: Re: How to write data from .txt Post rating: 0   New post Posted: Fri 09 Dec, 2011, 07:41 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
see:
https://www.dukascopy.com/wiki/index.php ... te_to_file


 
 Post subject: Re: How to write data from .txt Post rating: 0   New post Posted: Fri 28 Sep, 2012, 05:57 

User rating: 0
Joined: Thu 26 Apr, 2012, 14:41
Posts: 7
Hello Community and Support!

I am not sure how to adjust "FileRead" for a conditional statement.

I would like to check if a text file has a certain certain string such as "GoLong." And take an action if that is the case.

For example:

If text in C:\temp\trading.txt = "GoLong", then buy 100,000 EUR/USD at market.
If text in C:\temp\trading.txt = "GoShort", then sell 100,000 EUR/USD at market.

I have the rest of the approach worked out. This is the only missing peice.

Below is the FileRead class from the Wiki:

        public class FileRead {
                public boolean read() {
                        boolean orderExist = false;
                        try {
                                FileInputStream fstream = new FileInputStream(FILE_NAME);
                                // Get the object of DataInputStream
                                DataInputStream in = new DataInputStream(fstream);
                                BufferedReader br = new BufferedReader(new InputStreamReader(in));
                                while (((br.readLine()) != null) ) {
                                        orderExist = true;
                                        return orderExist;
                                }
                                in.close();
                        } catch (Exception e) { // Catch exception if any
                                console.getOut().print("File access error: " + e.getMessage());
                        }
                        return orderExist;
                }


 
 Post subject: Re: How to write data from .txt Post rating: 0   New post Posted: Fri 05 Oct, 2012, 07:26 

User rating: 0
Joined: Thu 26 Apr, 2012, 14:41
Posts: 7
Never mind. I got it.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com