Writing in to a Text file in Vista 32 OS

Dear Friends,
I have developed a standalone ticker in Adobe AIR, in that
iam storing setting options in a local text file. It is working
fine in XP.
but when i install my application(ticker) in Vista32 OS,
when i do changes in my setting file, i have to write the changes
in local text file. it is not writing the modified setting text in
the text file. my coding is:
function writefile() {
tempscr1=3;
var finalstr2:String =
"smallwinmode="+smscr+"&speed="+setmc.tickeropt.sld.s.value+"&alert="+altval+"&maxi="+max ifeed+"&alwtop="+setmc.tickeropt.aifch.selected+"&prescr="+tempscr1+"&prescrx="+newwindow3 .x+"&prescry="+newwindow3.y+"&firstinstal="+fins;
var dskTopFileStream2:FileStream = new FileStream();
var dskTopFile2:File = File.applicationDirectory;
var fileString2:String = (dskTopFile2.nativePath +
"\\settings.txt");
dskTopFile2 = dskTopFile2.resolvePath(fileString2);
dskTopFileStream2.openAsync(dskTopFile2, FileMode.WRITE);
dskTopFileStream2.writeUTFBytes(finalstr2);
dskTopFileStream2.close();
Anybody can help me. if it works in Vista also i can release
my product, i got struct up... kindly tell me should i change my
coding to write txt file in Visa? pls help me....
Thanks in advance,
Syed Abdul Rahim

Your user probably doesn't have permission to write to the
application directory. The OS is right to protect the program
directory.
You should be writing data files into the user's home
directory somewhere. All of the other "somethingDirectory"
properties of File name such directories. For files that the user
doesn't actually work with directly, I prefer
applicationStorageDirectory myself. For files you are writing out
for the user to see, I'd use documentsDirectory instead.

Similar Messages

  • Writing HTML data in TEXT File

    I am writing HTML content in TEXT file ...I read it in a string and then write using PrintStream...
    But it writes all content on one line ..I want to write it as it was in source HTML file...

    Perchance, the OP is referring to the lack of carriage returns in his outputted data, and querying where they have absconded to? An analysis of his posts to date reveals that he has read the contents of a File into a String variable, and wants to write the (presumably modified) String back to a file (uncertain as to whether this is the same file or a different one) In the process of outputting to said file, carriage returns previously contained in the original input file are not present in the output. I would hazard a guess that the OP does not want said carriage returns in the String to disappear.
    Is my analysis of the situation correct?
    An example of the code that you have written to date would be of extreme usefulness to us in aiding you in your noble quest.
    Without such a resource, I must rely on my intuition instead.
    Possible places that the carriage returns are being "dropped"
    1 - On reading in. Are you discarding carriage returns while building up your variable?
    2 - On manipulating. Are you processing this line by line, or reading it all into one large variable?
    3 - On output - are you using "print" or "println" in the output?
    I look forward to further correspondence with you sir
    kind regards,
    evnafets

  • Writing in between a text File

    Hi all,
    During a task, I am facing an interesting problem, this came first time since my 2 years development in Java.
    In always use
    BufferedReader in = new BufferedReader(new FileReader("/home/oracle/init1.txt"));
    to read from file and,
    PrintWriter opRpt = new PrintWriter ( new FileWriter("/home/oracle/init1.txt", true));
    to write to a file.
    This always works fine, but in the current task, I have to write in a text file,
    This file has e.g. 120 lines and I have to write after 36th line.
    So far, the suggestion I found is first to open text file (e.g. A),
    write first 36 lines to another file (e.g. B)
    then write new line to B,
    and then write remaining lines from A to B.
    Is there any easy way to do this job...
    Please guide me, I m in trouble.
    Thankx in advance.

    Please guide me, I m in trouble.No you're not; you already outlined a fine scenario how to accomplish this. If your file really contains just
    ~100 lines, an alternative would be to read the entire thing in core (the first part), add the new line(s)
    and read the rest of the file. Close the file and reopen it for writing again (effectively destroying its old
    contents) and write the new contents to the file again. An List containing all the lines of the
    file would do fine here.
    kind regards,
    Jos

  • Error writing path into a text file

    Latest edit to my text edit script is trying to remember the last opened file using a .txt "preference" file in a script bundle.
    Before I click run I edit the Pref file and put Default. I then click Open last. It then does what it should (alot like my other post) but gets an error at the last write in the script, writing the file path to the pref file. This is taken from the event viewer:
    write alias "Macintosh HD:Users:Richard:Documents:Other Text Files:Untitled.txt" to file "Macintosh HD:Users:Richard:Library:Scripts:Richard's Text Editor 3.scptd:Contents:Resources:Prefs:Save Location Pref.txt" as text
    Result:
    error "Can’t make alias \"Macintosh HD:Users:Richard:Documents:Other Text Files:Untitled.txt\" into type string." number -1700 from alias "Macintosh HD:Users:Richard:Documents:Other Text Files:Untitled.txt" to string
    Script here:
    display dialog "Open last saved or choose file" buttons {"Open last", "Open other"} default button 2
    if button returned of result is "Open last" then
    set val1 to (read POSIX file "/Users/Richard/Library/Scripts/Richard's Text Editor 3.scptd/Contents/Resources/Prefs/Save Location Pref.txt")
    if val1 is "Default" then
    EditFile("no")
    else
    EditFile(val1)
    end if
    else
    EditFile("no")
    end if
    on EditFile(val2)
    if val2 is "no" then
    set val3 to (choose file with prompt "Please select a .txt file:
    To save a text file as .txt in TextEdit, click 'Make Plain Text' in the Format menu and save the file.")
    --Get file path.
    else
    set val3 to val2
    end if
    if (get eof val3) is 0 then --Read doesn't like eof (end of file) to be 0 bytes.
    set val4 to ""
    else
    set val4 to read val3 --Read file before it gets erased.
    end if
    open for access val3 with write permission --Open file.
    set eof val3 to 0 --Erase file.
    repeat
    display dialog "Edit your text." default answer val4 buttons {"Revert", "Save"}
    set {val5, val6} to {text returned of result, button returned of result}
    if val6 is "Save" then
    write val5 to val3
    exit repeat
    else
    write val4 to val3
    end if
    end repeat
    --Write to file giving old data as default (to give the same affect as as read and edit).
    close access val3
    open for access POSIX file "/Users/Richard/Library/Scripts/Richard's Text Editor 3.scptd/Contents/Resources/Prefs/Save Location Pref.txt" with write permission
    set eof POSIX file "/Users/Richard/Library/Scripts/Richard's Text Editor 3.scptd/Contents/Resources/Prefs/Save Location Pref.txt" to 0
    write val3 to POSIX file "/Users/Richard/Library/Scripts/Richard's Text Editor 3.scptd/Contents/Resources/Prefs/Save Location Pref.txt" as text
    close access POSIX file "/Users/Richard/Library/Scripts/Richard's Text Editor 3.scptd/Contents/Resources/Prefs/Save Location Pref.txt"
    end EditFile
    Thanks, I can guess this is a simple fix like the others.

    Hmmm.
    First I checked it was all OK without POSIX and it works:
    display dialog "Open last saved or choose file" buttons {"Open last", "Open other"} default button 2
    if button returned of result is "Open last" then
    set val1 to alias (read file "Macintosh HD:Users:Richard:Library:Scripts:Richard's Text Editor 3.scptd:Contents:Resources:Save Location Pref.txt")
    --Read pref file to find out path of last edited file.
    if val1 is "Default" then
    EditFile("no")
    else
    EditFile(val1)
    end if
    else
    EditFile("no")
    end if
    on EditFile(val2)
    if val2 is "no" then
    set val3 to (choose file with prompt "Please select a .txt file:
    To save a text file as .txt in TextEdit, click 'Make Plain Text' in the Format menu and save the file.")
    --Get file path.
    else
    set val3 to val2
    end if
    if (get eof val3) is 0 then --Read doesn't like eof (end of file) to be 0 bytes.
    set val4 to ""
    else
    set val4 to read val3 --Read file before it gets erased.
    end if
    open for access val3 with write permission --Open file.
    repeat
    set eof val3 to 0 --Erase file.
    display dialog "Edit your text." default answer val4 buttons {"Revert", "Save"}
    set {val5, val6} to {text returned of result, button returned of result}
    if val6 is "Save" then
    write val5 to val3
    exit repeat
    else
    write val4 to val3
    end if
    end repeat
    --Write to file giving old data as default (to give the same affect as as read and edit).
    close access val3
    open for access file "Macintosh HD:Users:Richard:Library:Scripts:Richard's Text Editor 3.scptd:Contents:Resources:Save Location Pref.txt" with write permission
    set eof file "Macintosh HD:Users:Richard:Library:Scripts:Richard's Text Editor 3.scptd:Contents:Resources:Save Location Pref.txt" to 0
    write (val3 as string) to file "Macintosh HD:Users:Richard:Library:Scripts:Richard's Text Editor 3.scptd:Contents:Resources:Save Location Pref.txt" as text
    close access file "Macintosh HD:Users:Richard:Library:Scripts:Richard's Text Editor 3.scptd:Contents:Resources:Save Location Pref.txt"
    --Save path of edited file to pref file.
    end EditFile
    But change that 3rd line to:
    set val1 to alias (read file (path to resource "Save Location Pref.txt"))
    gets:
    Can’t make file (alias "Macintosh HD:Users:Richard:Library:Scripts:Richard's Text Editor 3.scptd:Contents:Resources:Save Location Pref.txt") into type file.
    P.S. Sorry bout question in answered post again.

  • Reading multiple text files and writing them to one text file

    Hi,
    I'm trying to read a number of text files and write them to a single master file. My program reads all the files but only writes the last one to the master file.
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    // Input/Output Classes
    import java.util.Scanner;
    import java.io.PrintWriter;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    import javax.swing.JFrame;
    import javax.swing.JTextField;
    import javax.swing.JTextArea;
    import java.awt.GridLayout;
    public class Actor implements ActionListener
    public static String DataRoot = "I:\\JAVA\\UBP\\DAT
    public static JFrame SW = new JFrame();
    public static JTextField txtSPath;
    public static JTextArea txtTable;
    public void actionPerformed( ActionEvent e )
    String Command = e.getActionCommand();
    if (Command.equals("Process") )
    SetupWin();
    ProcessAll();
    public void SetupWin()
    SW.setTitle("void");
    SW.setSize(300,400);
    SW.setLayout(new GridLayout(6,1));
    txtSPath = new JTextField(40);    SW.add(txtSPath);
    txtTable = new JTextArea(10, 40); SW.add(txtTable);
    SW.setVisible(true);
    public void ProcessAll()
    Process("Dunstable","Finance");
    Process("Dunstable","Production");
    Process("Dunstable","Sales");
    public void Process(String Town, String Dept)
    String SPath = DataRoot + Town + "
    " + Dept + ".txt";
    String MPath = DataRoot + "masterFile" + ".txt";
    txtSPath.setText(SPath);
    String message = "Trying  " + SPath;
    System.out.println(message);
    String SlaveTable=message;
    try// if following fails an exception is thrown
    Scanner Slave = new Scanner(new FileInputStream(SPath)); // reads slave file
    PrintWriter outputStream = null;
    outputStream = new PrintWriter(new FileOutputStream(MPath));
    while ( Slave.hasNextLine() ) // reads text line by line
    //Read and output next record
    String PartRecord  = Slave.nextLine();
    String FullRecord = Town + " " + PartRecord;
    System.out.println(FullRecord);
    outputStream.println(FullRecord);
    Slave.close();
    outputStream.close();
    txtTable.setText(SlaveTable);
    //An Exception Error would be THROWN by above & CAUGHT below
    catch(FileNotFoundException e)
    message = "Could Not Find " + SPath;
    System.out.println(message);     //console
    txtSPath.setText(message);     //window
    catch(IOException e)
    System.out.println("Slave I/O Problem " + SPath);
    }Edited by: Ardour on Mar 4, 2008 1:53 PM

    I haven't looked closely, but my spidey sense tingles at this:
    new FileOutputStream(MPath)This will clobber (erase) the previous contents of the file. Open in append mode:
    new FileOutputStream(MPath, true)Of course, if the file exists before you run this code, you will end up append to the original contents. If that is not wanted, consider using File's delete method first.

  • Writing Records in a Text File to Specific Columns in the Text File

    Help Please! I am a noooooooooobbbbbb!
    I have searched this forum looking for a procedure that will write records from my database into certain col (positions) in a text file. Example:
    1234 TONY TEST 84889922 Y 34 TORCHCOMP 34
    5678 BOB JOHNS 43534534 N 56 SAFDWEERE 65
    I am thinking I would like to setup variaables like:
    Consumer_ID = Consumer(position 1,5)
    Name = name(position 10,20)
    Invoice_No = Invoice(position 30,40)
    etc.
    Any input will be greatly appreciated
    Thank You

    Hi,
    That's a formatting issue.
    Formatting is best done in the front end. For example, using SQL*Plus:
    COLUMN     consumer_id     FORMAT 9999     HEADING     c_id
    COLUMN     filler_6_9     FORMAT A4     HEADING     " "
    COLUMN     name          FORMAT A11
    COLUMN     filler_21_29     FORMAT A9     HEADING     " "
    COLUMN     invoice_no     FORMAT 9999999999
    SET     COLSEP          ""
    SET     PAGESIZE     9999
    SPOOL     x.dat
    SELECT     consumer_id
    ,     ' '          AS filler_6_9
    ,     name
    ,     ' '          AS filler_21_29
    ,     invoice_no
    FROM     table_x;
    SPOOL     OFFIf you have to do it in the back end, use functions like TO_CHAR and RPAD to make each part exactly the right length, then concatenate them all into one big string:
    SET     PAGESIZE     0
    SPOOL     x.dat
    SELECT     TO_CHAR ( consumer_id
              , 'fm99999'
              )          -- 1-5
    ||     '    '               -- 6-9
    ||     RPAD ( name
              , 11
              )               -- 10-20
    ||     '         '          -- 21-29
    ||     TO_CHAR ( invoice_no
              , 'fm9999999999'
              )          -- 30-40
    FROM     table_x;
    SPOOL     OFFEdited by: Frank Kulash on May 22, 2009 10:40 AM

  • Writing data to a text file in a java code

    hey,
    can anybody tell me how can i enter data into a text file using java code.
    thanx

    yeah this is the proper answer....
    i had also a pblm ..that i had to read data from an excel sheet and write it to a File thru java code ....
    u can also use FileOutPutStream object....if u want...
    but there u can give newLine()..so all ur output will be in a single line to the file....
    bufferWriter.write(stringToBeWritten);
    bufferWriter.newLine();
    the stringToBeWritten can be a hardCoded string value..or any dynamic value like say fetching from database...

  • Problems writing a UTF-8 text file

    Hi,
    I'm trying to write a txt-file from a String array (data) in Unicode, that I need to process in a program working with the UTF-8 encoding. Every array entry (a string) must be written to a new line.
    Reading the tutorial, I tried
    FileOutputStream outputFile = new FileOutputStream ("aFile.txt");
    Writer out = new OutputStreamWriter(outputFile, "UTF8");
    for(j=0;j<data.length;j++){
         out.write(data[j]+'\n');
    All characters are set to UTF-8, except the New Line character ('\n'), which a UTF8 text editor doesn't recognise. The result is a txt-file of one line, with an 'error square' between the data-values.
    Does anybody knows how to encode the file, so that it works in UTF8-encoded systems?
    thanks,
    Koen.

    except the New Line character ('\n'), which a UTF8 text editor doesn't recognise.This is a valid UTF-8 character, however. Your complaint is not that the editor doesn't recognize it, your complaint is that the editor chooses to render it as a square block.
    Perhaps your problem is that the editor in question is that one from Microsoft? In that case all you have to do to make it act right is to use \r\n instead of \n.

  • Writing To A Specific Text File Line

    In a program I am writing I need to be able to write to the end of a specific line in a textfile. I'm not sure of any particular way to do this apart from perhaps rewriting the whole textfile which would be a pain to do. Does anyone know of a simpler way of how to do this?

    RandomAccessFile would help somewhat; with it you could overwrite at a given location by moving the file pointer. The problem with this is it still doesn't solve your case, which is appending. Files are essentially large arrays of data, so you can't easily insert data in the middle of it without having to rewrite the remaining portion of the file.

  • Writing to a new line in a text files

    I have a servlet that collects results from a questionnaire by getting the parameter values of the radio buttons on a questionnaire page. I am trying to store the results of the questionnaire by writing them to a text file. I can get it to write to the files fine but cannot seem to get it to write the next set of results to a new line. I have many different ways but cannot seem to get it to work. Any ideas?
    Heres the part of the code that writes to a text file
    String lineRead = "";
                int lineCount = 0;
                while((lineRead = input.readLine()) != null)
                    lineCount ++;
                    String result = request.getParameter("question" + lineCount);
                    output.write(result + ",");       
                    output.write("\n");

    Heres the part of the code that writes to a text
    file
    String lineRead = "";
    int lineCount = 0;
    while((lineRead = input.readLine()) !=
    adLine()) != null)
    lineCount ++;
    String result =
    String result = request.getParameter("question" +
    lineCount);
    output.write(result + ",");       
    output.write("\n");
    Can you do output.writeln(result + ",");?
    Failing that, putting output.write("\n") inside the while loop should do the trick.

  • Controlling the share permission when writing a text file

    I have several application that writes a delimited text file to a file share.  Another application, not a LabVIEW application then reads the delimited text file.  When my application is creating and/or writing to the delimited text file, is there a way to manipulate the permissions so that no other application can read the file at the same time I'm writing to the file?  I can do this in Visual Basic via the FileShare (http://msdn.microsoft.com/en-us/library/system.io.fileshare(v=vs.110).aspx) option when creating filestream, but I don't see this option in LabVIEW.  Thanks.
    Solved!
    Go to Solution.

    Nevermind.  I believe this can be accomplished with the "Deny Access" function.

  • High Score Table: Writing a Simple Text File with Flash and PHP

    I am having a problem getting Flash to work with PHP as I need Flash to read and write to a text file on a server to store simple name/score data for a games hi score table. I can read from the text file into Flash easily enough but also need to write to the file when a new high score is reached, so I need to use PHP to do that. I can send the data from flash to the php file via POST but so far it is not working. The PHP file is confirmed as working as I added an echo to the file which displayed a message so I  could check that the server was running PHP - the files were also uploaded to a remote server so I  could test them properly. Flash code is as follows:
    //php filewriter
    var myLV = new LoadVars();
    function sendData() {
    //sets up variable 'hsdata' to send to php
    myLV.hsdata = myText;
    myLV.send("hiscores.php");
    I believe this sends the variable 'myText' to the php file as a variable called 'hsdata' which I want the php file to write into a text file. The mytext variable is just a long string that has all the scores and names in the hiscore. OK, XML would be better way of doing this but for speed I just want to get basic functionality working, so storing a simple text sting is adequate for now. The PHP code that reads the Flash 'hsdata' variable and writes it to the text file 'scores.txt' follows:
    <?php
    //assigns to variable the data POSTed from flash
    $flashdata = $_POST["hsdata"];
    //file handler opens file and erases all contents with w arg
    $fh = fopen("scores.txt","w");
    //adds data to file
    fwrite ($fh,$flashdata);
    //closes file
    fclose ($fh);
    echo 'php file is working';
    ?>
    Any help with this would be greatly appreciated - once I can get php to write simple text files I should be ok. Thanks.

    Thanks for your help.
    I have got Flash working to a certain extent with PHP using loadVars but have been unable to get flash to receive a variable declared in PHP. Here's my Flash code:
    var outLV = new LoadVars();
    var inLV = new LoadVars();
    function sendData() {
    outLV.hsdata = "Hello from Flash";
    outLV.sendAndLoad("http://www.mysite.com/hiscores/test23.php",inLV,"post");
    inLV.onLoad = function(success) {
    if (success) {
      //sets dynamic text box to show variable sent from php
      statusTxt.text = phpmess;
    } else {
      statusTxt.text = "No Data Received";
    This works ok and the inLV.onLoad function reports that it is receiving data but does not display the variable received from PHP. The PHP file is like this:
    <?php
    $mytxt =$_POST['hsdata'];
    $myfile = "test23.txt";
    $fh = fopen($myfile,'w');
    //adds data to file
    fwrite($fh, $mytxt);
    //closes file
    fclose ($fh);
    $mess = "hello there from php";
    echo ("&phpmess=$mess&");
    ?>
    The PHP file is correctly receiving the hsdata from flash and writing it to a text file, but there seems to be a problem with the final part of the code which is intended to send a variable called 'phpmess' back to Flash, this is the string "hello there from php". How do I set up Flash and PHP so that PHP can send a variable back to Flash using echo? Really have tried everything but am totally baffled. Online tutorials have given numerous different syntax configurations for how the PHP file should be written which has really confused me - any help would be greatly appreciated.

  • HOw to create a text file in the given path and delete it after the use?

    Hi all,
    I am trying to create a text file at the given path and delete the created file after the use.
    I am using following code.:
    import java.io.*;
    // write binary data as characters
    public class RanIO {
                                            public static void main(String f[])
                                                      // First illustrate append
                                                      String lineSep = "\n";
                                                      try {
                                                                     File temp= new File("C:/Ash","cute.txt");
                                                      boolean ch=temp.createNewFile();
                                                      if(ch)
                                                           System.out.println("file created");
                                                      else
                                                      System.out.println("file Not created");
                                                      //writing to file
                                                 /*     PrintWriter p = new PrintWriter(new BufferedWriter(new FileWriter("cute.txt",true)));
                                                      p.print("Emp NO");
                                                      p.close();*/
                                                                // Open fileWriter in append mode
                                                                               FileWriter fos = new FileWriter(temp, true);
                                                                               BufferedWriter bw = new BufferedWriter(fos);
                                                                               PrintWriter pw = new PrintWriter(fos);
                                                                               double d=550;
                                                                          // lineSep = System.getProperty("line.separator");
                                                                          pw.print("Hello");
                                                                          //pw.print( lineSep );
                                                                          pw.print( d );
                                                                          pw.close();
                                  boolean det=temp.delete();
                                                 if(det)
                                                      System.out.println("File deleted");
                                                 else
                                                      System.out.println("File not deleted");
                                                 } catch (IOException ioe)
                                                                System.out.println( "Append IO error:" + ioe );
    My problem:
    1)
    I am not able to write to the file. I want to know, where i am going wrong.
    It is giving error message like
    "Canot resolve Symbol: temp,"
    But, FileWriter Constructor should accept a File type parameter.
    here temp is a file parameter.
    If i am not using file=new file();
    i can't delete the file after the use. i.e if i use
    PrintWriter p = new PrintWriter(new BufferedWriter(new FileWriter("cute.txt",true)));
    how can i delete cute.txt after the use?
    2)
    I am not able to write to the text file. file is created but, a blank file.
    "Hello" is not written into the text file.
    can anyone help me in this regard
    Thanks in advance
    Ashvini

    Thank you Ram,
    But, i want to create a text file in Append mode.
    for that i used
    FileWriter fos = new FileWriter(temp,true); But, it is not accepting FileWriter constructor in
    this format. if i use
    FileWriter fos = new
    FileWriter("c:/ash/cute.txt",true); it works fine. !!!!!Here's the javadoc
    public FileWriter(File file,
    boolean append)
    throws IOExceptionConstructs a FileWriter object given a File object. If the second argument is true, then bytes will be written to the end of the file rather than the beginning.
    Parameters:
    file - a File object to write to
    append - if true, then bytes will be written to the end of the file rather than the beginning
    Throws:
    IOException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
    Since:
    1.4
    Are you using jdk.13 or lower ?
    >
    ONe more doubt, Does flush method deletes a file?
    if not, then i need to use
    File temp=new File("c:/ash/cute.txt");
    FileWriter fos = new FileWriter(temp,true); //which
    is again a problem
    if(temp.delete())
    out.println("File is deleted");
    }I don't know whether i am taking it wrong ! or
    anything wrong with my coding ! but, after creating
    and writing data into a text file. I must delete it
    as it contains confidential informations.
    Regards,
    Thanks.'flush' writes to a file immediately. Else you should explicitly call 'flush' to write contents from buffer to underlying source.
    javadoc again
    PrintWriter
    public PrintWriter(Writer out,
    boolean autoFlush)Create a new PrintWriter.
    Parameters:
    out - A character-output stream
    autoFlush - A boolean; if true, the println, printf, or format methods will flush the output buffer
    cheers,
    ram.
    Question; What do you gain by opening a file, writing to it and deleting it in the same program ?

  • Write data to multiple text files after specific size

    Hello,
    I wrote a code that contineously writes data to  a text file. The problem is I am running this VI for long time and therefore this text file is being bigger in size e.g. more than 10MB. I want to split writing data in this text file after max 1MB size. Can anyone help ????
    thanks in advance.

    CMW.. wrote:
    You could use the "File/Directory Info Function" in the Advanced File VIs and Function palette to check the size. If the file is too big. close it and create a new one.
    I would use the Get File Position since this won't cause Windows to have to do so much.  Assuming you are just writing and not setting the file position manually, this will return the size of the file in bytes (file position will always be at the end of the file).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to write list values to a text file?

    Hi. Does anyone know how to write values stored in a List to a text file? I have a program that asks the user to enter a name and stores it in a list. The number of names in the list depends on how many times the user wants to enter a name. The problem is that my writeToFile method, which handles writing values to a text file, only writes one name and overwrites any previous names. How could I fix this so that it goes thru the list and writes every value to the file? Any hints would be appreciated!
    peace
    Chris
    import java.util.*;
    import java.io.*;
    public class StoreNames
    String name;
    char answer;
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    public void anotherName(List a)throws IOException
    System.out.println("Enter another name? (Y or N)");
    answer = (char)System.in.read();
    System.in.skip(2);
    while(answer == 'Y' || answer == 'y')
    inputName(a);
    System.out.println("Enter another name? (Y or N)");
    answer = (char)System.in.read();
    System.in.skip(2);
    if (answer == 'N' || answer == 'n')
    System.out.println("Ok. GoodBye");
    writeToFile(a);
    //prompts user to input names
    public void inputName(List a) throws IOException
    System.out.print("Enter a name: ");
    name = input.readLine();
    a.add(name);
    public void writeToFile(List a)throws IOException
    PrintWriter output = new PrintWriter(new FileWriter("names.txt"));
    output.print(name); //Problem area - handles only one line of input, overwrites previous input
    output.close();

    System.out is an instance of PrintStream (check the API documents for the System class to see this).
    So the easiest way to convert from a "print to screen" class to a "print to file" class is to acquire a PrintStream that prints to a file, and use it exactly the same as you'd have used System.out...
    So start with your console code...
            PrintStream out = System.out;
            for(int i = 0; i <10; i++){
                out.println("Number " +i);
            }Then you adapt to file code:
            FileOutputStream fos = new FileOutputStream("temp.txt");
            PrintStream out = new PrintStream(fos);
            for(int i = 0; i <10; i++){
                out.println("Number " +i);
            out.flush();
            out.close();Note that we flush the stream because for reasons of efficiency files aren't necessarily written to disk until you explicitly ask the system to do so (memory is fast, disks are slow, that's why).
    Closing the stream releases system resources associated with it.
    Actually, that's redundant, because close calls flush automatically, but I left it in for clarity.
    Any use ?

Maybe you are looking for

  • IMovie can no longer import video from camcorder.

    I have been using iMovie '09 with a Sony DCR-SR85 camcorder for over a year with no problems. Suddenly, I cannot import from the camera anymore. With the camera connected and the disk image mounted, I run iMovie and click on the camera import button.

  • Connecting MBP to an HDTV

    I just bought a new Sony Bravia 1080p LCD television and was able to easily connect my MPB to the new television with a cable supplied in the box by Sony and the adapter supplied by Apple (Seems to be some kind of 9-pin cable...not sure what it is ca

  • SAP NW BRM (java) and ABAP Customizing Tables

    Hi, A lot of "rules" of standard SAP (ERP for example) is traditionally located in Customizing Tables. What is the nicest way to integrate those "rules" with NW BRM without creating double maintenance, or UI disconnects (where the user has 2 apps ope

  • Cannot access Existing Accoun Wizard Settings to change to IMAP?

    I cleared the check boxes - Check for new messages at start up Download messages every x minutes I clicked on FILE - NEW - EXISTING MAIL ACCOUNT - but it just opened the Wizard called 'Mail Account set up' When alternatively I open the Server Setting

  • Dynamic modifcation rule / Skip

    Hi It is hard for me to understand the rule and the skip procedure . Can any explain me please with and without skip( Settings ) Stage Change Defined for Inspection Stage No of inspections New stage Max skip duration Rejection New inspection Thanks J