How do I prevent sharing a text file by different users

Hello,
I am using LV8.6.1 and writing this application that read and write to a text file. The application is being used by many users at different sites and I want to prevent writing to the text file when other user is already using it (reading or writing to it). The other user should only be able to use it when it's not being read or getting written.
Any suggestions? I know LV file function 'Set Permissions' won't work. I need a file attribute that tells that the file is open, so don't use it.

I think the only real obtion is one I've seen some other programs use.
Create a lock file in the same directory.
1.  You want to open myfile.txt.
2.  Your program looks to see if myfile.lck is present.  (Same filename, just the extension is different)
3.  If it is present, you don't open the file or you give a warning.
4.  If it is not present, you create a myfile.lck file.  It could be a small text file.  Perhaps you place in it the user name of the person who is opening the file.
5.  When your VI is done with the file and "closes" it, your VI deletes the myfile.lck file.
So the presence of the myfile.lck file indicates the file is being used.
The absence of the myfile.lck indicates the file is available to be used.
The only risk is if somehow the person who "takes out" the file somehow ends their application unexpectedly and the .lck file doesn't get deleted even though they are done.  You would need to manually go in and delete the .lck file.  But username data in the .lck could help determine who had the file last and you could confirm if they are really using it or not.  Putting the filedate in the warning information would help determine if it was a recent lock, or an old lock that is likely stale.

Similar Messages

  • Modify text file by different user?

    My AIR Application create one text file under Administrator. but guest user cannot modify that text file.The code is below
    var file:File = new File("file:///D:/BALA /test.txt ");
    var str = String(Math.round(Math.random()*9)+1);
    var fileStream:FileStream = new FileStream();
    fileStream.openAsync(file, FileMode.WRITE);
    fileStream.writeUTFBytes(str);
    fileStream.close();
    Can any one solve this issue?
    Thanks
    Regards
    Balasubramaniyan.S

    The AIR app has the OS rights of the user account used to run the app.

  • How do you gain access to all files on different users?

    How do you gain access to all files and folders for each user?

    http://forums.whirlpool.net.au/archive/718273

  • How to get the content of text file to write in JTextArea?

    Hello,
    I have text area and File chooser..
    i wanna the content of choosed file to be written into text area..
    I have this code:
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.*;
    public class Test_Stemmer extends JFrame {
    public Test_Stemmer() {
    super("Arabic Stemmer..");
    setSize(350, 470);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setResizable(false);
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    JButton openButton = new JButton("Open");
    JButton saveButton = new JButton("Save");
    JButton dirButton = new JButton("Pick Dir");
    JTextArea ta=new JTextArea("File will be written here", 10, 25);
    JTextArea ta2=new JTextArea("Stemmed File will be written here", 10, 25);
    final JLabel statusbar =
                  new JLabel("Output of your selection will go here");
    // Create a file chooser that opens up as an Open dialog
    openButton.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent ae) {
         JFileChooser chooser = new JFileChooser();
         chooser.setMultiSelectionEnabled(true);
         int option = chooser.showOpenDialog(Test_Stemmer.this);
         if (option == JFileChooser.APPROVE_OPTION) {
           File[] sf = chooser.getSelectedFiles();
           String filelist = "nothing";
           if (sf.length > 0) filelist = sf[0].getName();
           for (int i = 1; i < sf.length; i++) {
             filelist += ", " + sf.getName();
    statusbar.setText("You chose " + filelist);
    else {
    statusbar.setText("You canceled.");
    // Create a file chooser that opens up as a Save dialog
    saveButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    JFileChooser chooser = new JFileChooser();
    int option = chooser.showSaveDialog(Test_Stemmer.this);
    if (option == JFileChooser.APPROVE_OPTION) {
    statusbar.setText("You saved " + ((chooser.getSelectedFile()!=null)?
    chooser.getSelectedFile().getName():"nothing"));
    else {
    statusbar.setText("You canceled.");
    // Create a file chooser that allows you to pick a directory
    // rather than a file
    dirButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    JFileChooser chooser = new JFileChooser();
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int option = chooser.showOpenDialog(Test_Stemmer.this);
    if (option == JFileChooser.APPROVE_OPTION) {
    statusbar.setText("You opened " + ((chooser.getSelectedFile()!=null)?
    chooser.getSelectedFile().getName():"nothing"));
    else {
    statusbar.setText("You canceled.");
    c.add(openButton);
    c.add(saveButton);
    c.add(dirButton);
    c.add(statusbar);
    c.add(ta);
    c.add(ta2);
    public static void main(String args[]) {
    Test_Stemmer sfc = new Test_Stemmer();
    sfc.setVisible(true);
    }could you please help me, and tell me what to add or to modify,,
    Thank you..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    realahmed8 wrote:
    thanks masijade,
    i have filter the file chooser for only text files,
    but i still don't know how to use FileReader to put text file content to the text area (ta) ..
    please tell me how and where to use it..How? -- See the IO Tutorials on Sun for the FileReader (and I assume you know how to call setText and append in the JTextArea).
    Where? -- In the actionPerformed method (better would be a separate thread that is triggered through the actionPerformed method, but that is probably beyond you at the moment), of course.
    Give it a try.

  • Where are these unix executable files coming from and how do I recover the original text file?

    where are these unix executable files coming from and how do I recover the original text file?

    When you upgraded to Lion did you have AppleWorks installed on your mac?
    Most of the AW documents can be opened by Pages 09 or Numbers 09 with most of the orginal format in tact. (I do not know if previouse verision will work) just open the AW file with both and see which one works best.
    Text Edit will also open most of the AW files as well but will require a lot of work to restore them to their orginal format.
    If you have AW Database documents then they are not supported. 
    These document show up as "exec icons", Kind: Unix Executagle File.
    They also will show up as .cwk file if they are small files. I have a couple that were under 1mb that are shown as " Kind: AppleWorks Document" but will not open.
    The only option to open AW database is to have AW installed on a mac with a pre-Lion OS to recover the file.

  • How can u insert and retrieve text files in any format using forms6i.

    how can u insert and retrieve text files in any format using forms6i.
    can u give me an example of an insert statement, let's assume the file is located in the a:drive.
    and retrieving the files, i would give the user a list of all the files that are in the database, the user would select one, but what command(or piece of code) would open the file in its apppropriate editor.
    e.g .pdf formatted file would open in acrobat.
    any help would be appreciated.
    Thanks
    Hussein Saiger

    the filereference class is for downloading and uploading files.
    if you want to load xml, use the xml class.
    and, if you want to write to an xml file and don't want to use server-side code, wait.

  • How do i point this at a file in my User folder?

    How can i point this at a file in my users folder?
    property csvAlias : alias ((path to desktop as text) & "SourceFiles:ean2sku.csv") --path to your csv-File as alias

    Standard Additions has a path to command that will return most common locations, such as path to home folder.  Note that an alias will need to exist when it is declared.

  • DSC powershell xwindowsprocess to execute batch file under different user account

    DSC powershell run under "NT AUTHORITY\SYSTEM".
    I am trying to execute a batch file under different user account using xwindowsprocess in DSC resource kit.
    I created a custom dsc resource with 3 parameters namely Exepath, Arguments, Credential.
    I received those parameter values in settargetresource method.
    CallPInvoke
    [Source.NativeMethods]::CreateProcessAsUser(("$ExePath "+$Arguments), $Credential.GetNetworkCredential().Domain, $Credential.GetNetworkCredential().UserName, $Credential.GetNetworkCredential().Password)
    I tested it by invoking a batch file and writing username under which it executes to a text file.
    After executing, the output text file still contains the "Systemname$".

    Configuration Sample_xService_ServiceWithCredential
    param
    [string[]]
    $nodeName = 'localhost',
    [System.String]
    $Name,
    [System.String]
    [ValidateSet("Automatic", "Manual", "Disabled")]
    $StartupType="Automatic",
    [System.String]
    [ValidateSet("LocalSystem", "LocalService", "NetworkService")]
    $BuiltInAccount="LocalSystem",
    [System.Management.Automation.PSCredential]
    $Credential,
    [System.String]
    [ValidateSet("Running", "Stopped")]
    $State="Running",
    [System.String]
    [ValidateSet("Present", "Absent")]
    $Ensure="Present",
    [System.String]
    $Path,
    [System.String]
    $DisplayName,
    [System.String]
    $Description,
    [System.String[]]
    $Dependencies
    Import-DscResource -Name MSFT_xServiceResource -ModuleName xPSDesiredStateConfiguration
    Node $nodeName
    xService service
    Name = $Name
    DisplayName = $DisplayName
    Ensure = $Ensure
    Path = $Path
    StartupType = $StartupType
    Credential = $credential
    $Config = @{
    Allnodes = @(
    Nodename = "localhost"
    PSDSCAllowPlainTextPassword = $true
    #Sample Scenarios
    $credential = Get-Credential
    Sample_xService_ServiceWithCredential -ConfigurationData $Config -Name "Sample Service" -DisplayName "Sample Display Name" -Ensure "Present" -Path "C:\DSC\TestService.exe" -StartupType Automatic -Credential $credential
    ¯\_(ツ)_/¯

  • How to Store something in a text file.

    Store the record of the session in a text file.
    please can any one tell me how can i create this thing.
    i cerate the button but does not work correctly and i can not save any calculation/
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.lang.Math.*;
    import java.math.BigInteger;
    public class Calculator2 extends JFrame implements ActionListener{
    JLabel lN1, lN2,lN3;//here are the Label.
    JTextField tN1, tN2;// here the place for the text field.
    JButton btnAdd,btnSub,btnMul,btnDiv,btnClear,btnSave; JTextArea outArea;//all our Button which are in the program.
    Calculator2(){//constructor.
    Box box=Box.createVerticalBox();//creation of the box.
    // input
    lN1=new JLabel("Write first number"); box.add(lN1);//creation of the input,the number which we want use.
    tN1=new JTextField(100); tN1.setEditable(true); box.add(tN1);//allows or prevents the user editing the text
    lN2=new JLabel("write second number"); box.add(lN2);
    tN2=new JTextField(100); tN2.setEditable(true); box.add(tN2);
    // buttons
    btnAdd=new JButton("+"); btnAdd.addActionListener(this); box.add(btnAdd);// button of addition operation
    // setPreferredSize();
    btnSub=new JButton("-"); btnSub.addActionListener(this); box.add(btnSub);// button of subtraction operation
    btnMul=new JButton("*"); btnMul.addActionListener(this); box.add(btnMul);// button of multiplication operation
    btnDiv=new JButton("/"); btnDiv.addActionListener(this); box.add(btnDiv);// button of division operation
    btnClear=new JButton("Clear"); btnClear.addActionListener(this); box.add(btnClear);// button of Clear operation
    btnSave=new JButton("Save"); btnSave.addActionListener(this); box.add(btnSave);// button of save operation
    // Output
    String desc="This is a simple integer calculator\n";//here the out put with text area.
    outArea=new JTextArea(desc,30,60);//out put area with the hight and length.
    ScrollPane scrollPane=new ScrollPane();//Creates an empty (no viewport view) JScrollPane where both horizontal and vertical scrollbars appear when needed
    scrollPane.add(outArea);
    box.add(scrollPane);
    Container c=getContentPane();
    c.add(box);
    c.setBackground(Color.green);//back ground color.
    setTitle("Calculator");//title
    setSize(600,375);//size
    setVisible(true);// visiblity of the program.
    private void showStatus(String status) {
    lN3.setText(status);
    public void actionPerformed(ActionEvent actionEvent){
    if(actionEvent.getSource()==btnClear){
    outArea.selectAll(); outArea.cut();
    } else {
    String sN1=tN1.getText(), sN2=tN2.getText(), sOp="";
    BigInteger bN1=new BigInteger(sN1);
    BigInteger bN2=new BigInteger(sN2);
    BigInteger bRes=BigInteger.ZERO, bResDiv[]={BigInteger.ZERO,BigInteger.ZERO};
    BigInteger bRemainder=BigInteger.ZERO;
    if(actionEvent.getSource()==btnAdd){bRes=bN1.add(bN2); sOp=" + ";}
    if(actionEvent.getSource()==btnSub){bRes=bN1.subtract(bN2); sOp=" - ";}
    if(actionEvent.getSource()==btnMul){bRes=bN1.multiply(bN2); sOp=" * ";}
    if(actionEvent.getSource()==btnDiv){sOp=" / ";
                if(bN2.signum()!=0)bResDiv=bN1.divideAndRemainder(bN2);//Math.signum() tells you what sign a number is....
                //returns zero if the argument is zero, 1.0 if the argument is greater than zero,
                //-1.0 if the argument is less than zero
                bRes=bResDiv[0]; bRemainder=bResDiv[1];
    if(sOp.equals(" / ") && bN2.signum()==0){
    // showStatus("Cannot divide by zero");
    } else {
    outArea.append(bN1.toString() + sOp+bN2.toString() + " = " + bRes.toString() + "\n");
    if(actionEvent.getSource()==btnDiv)outArea.append("Remainder = "+bRemainder.toString()+"\n");
    public static void main(String[] args) {//the main method of the program.
    new Calculator2().setVisible(true);
    }

    // This is a simple calculator that calculate 4 mathematical operations, addition,
    // subtraction, multiplication and division.
    // Author: Jean Chedid.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.lang.Math.*;
    import java.math.BigInteger;
    public class Calculator2 extends JFrame implements ActionListener{
        JLabel lN1, lN2,lN3;//here are the Label.
        JTextField tN1, tN2;// here the place for the text field.
        JButton btnAdd,btnSub,btnMul,btnDiv,btnClear,btnSave; JTextArea outArea;//all our Button which are in the program.
        Calculator2(){//constructor.
            Box box=Box.createVerticalBox();//creation of the box.
            // input
            lN1=new JLabel("Write first number"); box.add(lN1);//creation of the input,the number which we want use.
            tN1=new JTextField(100); tN1.setEditable(true); box.add(tN1);//allows or prevents the user editing the text
            lN2=new JLabel("write second number"); box.add(lN2);
            tN2=new JTextField(100); tN2.setEditable(true); box.add(tN2);
            // buttons
            btnAdd=new JButton("+"); btnAdd.addActionListener(this); box.add(btnAdd);// button of addition operation
            // setPreferredSize();
            btnSub=new JButton("-"); btnSub.addActionListener(this); box.add(btnSub);// button of subtraction operation
            btnMul=new JButton("*"); btnMul.addActionListener(this); box.add(btnMul);// button of multiplication operation
            btnDiv=new JButton("/"); btnDiv.addActionListener(this); box.add(btnDiv);// button of division operation
            btnClear=new JButton("Clear"); btnClear.addActionListener(this); box.add(btnClear);// button of Clear operation
            btnSave=new JButton("Save"); btnSave.addActionListener(this); box.add(btnSave);// button of save operation
            // Output
            String desc="This is a simple integer calculator\n";//here the out put with text area.
            outArea=new JTextArea(desc,30,60);//out put area with the hight and length.
            ScrollPane scrollPane=new ScrollPane();//Creates an empty (no viewport view) JScrollPane where both horizontal and vertical scrollbars appear when needed
            scrollPane.add(outArea);
            box.add(scrollPane);
            Container c=getContentPane();
            c.add(box);
            c.setBackground(Color.green);//back ground color.
            setTitle("Calculator");//title
            setSize(600,375);//size
            setVisible(true);// visiblity of the program.
         private void showStatus(String status) {
         lN3.setText(status);
        public void actionPerformed(ActionEvent actionEvent){
            if(actionEvent.getSource()==btnClear){
                outArea.selectAll(); outArea.cut();
            } else {
                String sN1=tN1.getText(), sN2=tN2.getText(), sOp="";
                BigInteger bN1=new BigInteger(sN1);
                BigInteger bN2=new BigInteger(sN2);
                BigInteger bRes=BigInteger.ZERO, bResDiv[]={BigInteger.ZERO,BigInteger.ZERO};
                BigInteger bRemainder=BigInteger.ZERO;
                if(actionEvent.getSource()==btnAdd){bRes=bN1.add(bN2); sOp=" + ";}
                if(actionEvent.getSource()==btnSub){bRes=bN1.subtract(bN2); sOp=" - ";}
                if(actionEvent.getSource()==btnMul){bRes=bN1.multiply(bN2); sOp=" * ";}
                if(actionEvent.getSource()==btnDiv){sOp=" / ";
                if(bN2.signum()!=0)bResDiv=bN1.divideAndRemainder(bN2);//Math.signum() tells you what sign a number is....
                //returns zero if the argument is zero, 1.0 if the argument is greater than zero,
                //-1.0 if the argument is less than zero
                bRes=bResDiv[0]; bRemainder=bResDiv[1];
                if(sOp.equals(" / ") && bN2.signum()==0){
                    // showStatus("Cannot divide by zero");
                } else {
                    outArea.append(bN1.toString() + sOp+bN2.toString() + " = " + bRes.toString() + "\n");
                    if(actionEvent.getSource()==btnDiv)outArea.append("Remainder = "+bRemainder.toString()+"\n");
        public static void main(String[] args) {//the main method of the program.
            new Calculator2().setVisible(true);
    }

  • How can I prevent the open/save file confirmation window popup ? Mine is currently set for "always do this action" but I still get the popup.

    Whenever I "export" a QIF file from my bank I get a File Action confirmation window popup. I have the correct application selected and I have it selected to "open" and "always do this action" but the popup always pops.
    I have checked the applications tab and the correct application is selected.
    How can I prevent the confirmation popup window please ?

    Cheers for the reply.
    I have deleted the rdf file but no difference. I still get the opening file box popup.
    From the resetting download actions link. Both lines in the about:config are missing.
    I have also tried switching the download option for the qif file to use a csr file but that also opens the confirmation box.
    I pulled this from the rdf file
    <RDF:Description RDF:about="urn:mimetype:handler:text/x-qif"
    NC:alwaysAsk="false"
    NC:saveToDisk="false"
    NC:useSystemDefault="false"
    NC:handleInternal="false">
    <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:text/x-qif"/>
    <NC:possibleApplication RDF:resource="urn:handler:local:C:\Program Files\Microsoft Money\System\msmoney.exe"/>
    </RDF:Description>
    <RDF:Description RDF:about="urn:scheme:webcal"
    NC:value="webcal">
    <NC:handlerProp RDF:resource="urn:scheme:handler:webcal"/>
    </RDF:Description>
    <RDF:Description RDF:about="urn:mimetype:externalApplication:text/x-qif"
    NC:path="C:\Program Files\Microsoft Money\System\msmoney.exe"
    NC:prettyName="msmoney.exe" />
    Not sure if that helps.
    Thanks again for the reply

  • How do I prevent Save as .csv file alwways appending .txt to the filename if I choose the "Open with" action?

    My ASP csv download page is calling:
    Response.Clear
    Response.AddHeader "content-disposition","attachment; filename=filename.csv"
    Response.ContentType = "Content-Type: text/csv; charset=utf-8"
    When I click on the link to this ASP page the Firefox "Opening filename.csv" dialog appears:
    filename.csv
    which is a: Text Document
    If I choose "Open with <Any Application name>" the file is always opened by the application with a .txt appended to the filename, which in this particular case prevents my spreadsheet software from correctly opening it.
    a) How do I prevent the .txt being appended to the file name if OpenWith is used?
    b) Is there a way to add a CSV type to the Tools->Options Applications Content Type list to prevent the "which is a: Text Document" message?
    This behaviour does not happen in Chrome, Opera, Safari or IE.

    Is there no entry in Application Options for text/csv?
    orange Firefox button ''or'' classic Tools menu > Options > Applications
    In the search box, type csv and pause while Firefox filters the list.
    If you have Microsoft Office installed, the dialog typically lists "Microsoft Office Excel Comma Separated Values File (text/csv)" (you need to display the mouseover tooltip to see all of it).
    I assume Firefox extracts this information from the registry. If you want to reset the Application Options and have Firefox rebuild them, the method is described in this article:
    https://support.mozilla.org/en-US/kb/cant-download-or-save-files#w_reset-download-actions-for-all-file-types ("Reset download actions for all file types")

  • How to import data from a text file into a table

    Hello,
    I need help with importing data from a .csv file with comma delimiter into a table.
    I've been struggling to figure out how to use the "Import from Files" wizard in Oracle 10g web-base Enterprise Manager.
    I have not been able to find a simple instruction on how to use the Wizard.
    I have looked at the Oracle Database Utilities - Overview of Oracle Data Pump and the Help on the "Import: Files" page.
    Neither one gave me enough instruction to be able to do the import successfully.
    Using the "Import from file" wizard, I created a Directory Object using the Create Directory Object button. I Copied the file from which i needed to import the data into the Operating System Directory i had defined in the Create Directory Object page. I chose "Entire files" for the Import type.
    Step 1 of 4 is the "Import:Re-Mapping" page, I have no idea what i need to do on this page. All i know i am not tying to import data that was in one schema into a different schema and I am not importing data that was in one tablespace into a different tablespace and i am not R-Mapping datafiles either. I am importing data from a csv file.
    For step 2 of 4, "Import:Options" page, I selected the same directory object i had created.
    For step 3 of 4, I entered a job name and a description and selected Start Immediately option.
    What i noticed going through the wizard, the wizard never asked into which table do i want to import the data.
    I submitted the job and I got ORA-31619 invalid dump file error.
    I was sure that the wizard was going to fail when it never asked me into which table do i want to import the data.
    I tried to use the "imp" utility in command-line window.
    After I entered (imp), i was prompted for the username and the password and then the buffer size as soon as i entered the min buffer size I got the following error and the import was terminated:
    C:\>imp
    Import: Release 10.1.0.2.0 - Production on Fri Jul 9 12:56:11 2004
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Username: user1
    Password:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Import file: EXPDAT.DMP > c:\securParms\securParms.csv
    Enter insert buffer size (minimum is 8192) 30720> 8192
    IMP-00037: Character set marker unknown
    IMP-00000: Import terminated unsuccessfully
    Please show me the easiest way to import a text file into a table. How complex could it be to do a simple import into a table using a text file?
    We are testing our application against both an Oracle database and a MSSQLServer 2000 database.
    I was able to import the data into a table in MSSQLServer database and I can say that anybody with no experience could easily do an export/import in MSSQLServer 2000.
    I appreciate if someone could show me how to the import from a file into a table!
    Thanks,
    Mitra

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to work on 2 open text files in one main program

    I write to one text file and then I close it. I then open another text file in the same "main" class but I cannot write to this file - I get the following error: "Exception in thread "main" java.util.NoSuchElementException".
    Here's the code with the line underlined, at which point the error above gets reported:
    import java.io.*;
    import java.util.*;
    public class TwoFileStudentMarks
    public static void main(String[] args) throws IOException
    PrintWriter stFile = new PrintWriter (new FileWriter ("stFil.txt"));
    Scanner kbd = new Scanner(System.in);
    int lineNum = 0;
    System.out.println("Type in a name: (ZZZ to stop)");
    String name = kbd.nextLine();
    while (!name.equalsIgnoreCase("ZZZ"))
    stFile.println(name);
    lineNum++;
    System.out.print("Input next name: (ZZZ to stop)");
    name = kbd.nextLine();
    stFile.close();
    kbd.close();
    PrintWriter tstFile = new PrintWriter (new FileWriter ("tstFil.txt"));
    kbd = new Scanner(System.in);
    for (int j=0; j<lineNum; j++)
    for (int i=0; i<3; i++)
    System.out.print("For student " + j + " enter test " + i + ": ");
    int tst = kbd.nextInt();
    tstFile.print(tst+" ");
    tstFile.println();
    tstFile.close();
    kbd.close();
    } // end main     
    } // end class

    Thank You for responding to my question. I am new to the forum. I have posted only ONE question since joining on Novemebr 5th, 2007. So I have a question. What are tags  and how does one include them in a question that one wishes to post to the forum?
    Secondly, my experience of Java is only about 10 months. So any advice, tips, replies are greatly appreciated and most welcome, so that I may continue to use this language.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to import data from a text file through DTS to Sql Server

    Please don't mistake me as i'm a new comer to sql server,please help me.
    how to import the data present in a plain text file through DTS into sql server and store the data in a temporary table.
    How far the temporary table is stored in the database.
    Please reply me as soon as possible.
    Thank you viewers.

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to save input from a text file in to array

    I got this assignment, and almost have no clue, and my teacher doesn't even teaches us anything
    This is what i am suppose to do
    5. The program must store the following data about each student in this Talent Show:
    * The student's name (store as a String)
    * The student's average time score [only for the events they competed in] (store as a Double)
    Note: Some of the data comes directly from the text file, and some of the data must be calculated from the data that is read from the file.
    6. The program must search through all of the student's scores to find the student who has the minumum average time of all students.
    7. You must calculate how many events each student played. Zero values are not counted.
    8. You must then generate a report on the screen that prints out
    * the total number of students in the competition,
    * the winning student's ...
    o name
    o times
    o average time (rounded to one decimal places)
    Sample output
    btw this is the data file
    Bart Simpson
    7.5
    12.3
    7.8
    19.2
    9.9
    5.3
    8.5
    11.8
    2.2
    4.6
    Stewie Griffin
    9.5
    29.7
    7.8
    22.5
    9.9
    12.6
    8.5
    0
    8.2
    0
    Pinky
    2.5
    0
    1.8
    0
    3.9
    0
    6.5
    0
    5.2
    12.1
    Rocky N Bullwinkle
    10.0
    22.2
    9.5
    17.5
    9.9
    1.5
    8.7
    23.7
    9.2
    11.0
    Angelica Pickles
    5.5
    11.1
    6.8
    12.2
    7.9
    13.3
    8.1
    5.1
    7.2
    7.9
    Pink Panther
    8.5
    5.5
    8.8
    6.6
    8.9
    7.7
    9.9
    8.8
    2.2
    9.9
    Josie
    9.5
    0
    8.8
    12.2
    9.9
    0
    8.5
    0
    9.2
    5.3
    Rogue
    8.5
    1.1
    7.8
    2.2
    7.9
    3.3
    7.5
    4.4
    8.2
    5.5
    Usagi Tsukino
    8.5
    15.5
    8.8
    30.1
    9.9
    19.7
    9.5
    11.0
    8.2
    8.6
    Yosemite Sam
    0
    15.2
    0
    29.5
    3.9
    0
    0
    16.0
    0
    7.7
    My code so far
    import java.io.*;
    public class test
        public static void main (String [] args)
            FileInputStream File1;
            DataInputStream In;
            String fileInput = "";
            try
               File1 = new FileInputStream ("data.txt");
                In = new DataInputStream (File1);
                while (In.available () > 0)
                    fileInput = In.readLine ();
                    System.out.println (fileInput);
                In.close ();
            catch (FileNotFoundException e)
                System.out.println ("Error - this file does not exist");
            catch (IOException e)
                System.out.println ("error=" + e.toString ());
    }My question, how do i save the data in to an array, and how do i seperatly save names in to different array, and their scores in to different arrays
    bte he said you can use scanner class
    Thanks
    Edited by: supahsain08 on Mar 26, 2008 2:55 PM

    supahsain08 wrote:
    Well, you are not in my class and you don't even know my teacher
    who are you to judge meHe is jaded by our experiences here. 99% of posters who complain that the teacher doesn't teach have adequate (note that I didn't say good) teachers, but it's the student who is failing to take responsibility for his own education. It is after all your responsibility and complaining won't help you any.
    Good luck.

Maybe you are looking for

  • Connecting A Dreamweaver site to a database using localhost

    I have created a number of websites that connect to a databasde on localhost using the Windows\database utility built into Dreamweaver with no problems. Recently my version of Dreamweaver started crashing and DW Support did some work to rer4solve tha

  • Soundsticks bug!!!

    Since installing SnowLeopard my original USB connected Harmon Kardon soundsticks will not stay selected as my sound output device on reboots. The SL 6.1 update has not fixed this. After each reboot I have to go to the System Prefs and select them as

  • Mac Mini Server & OS X Lion

    Can I wipe off the Snow Leopard server version running on a 2.53 Ghz Core 2 Duo Server and install the "normal" OS X lion on it...? I do not want the server version... If so, what are the steps I should follow.. Thanks in advance.

  • Regarding performence issue of  Z-Report

    Hello experts While i am analyzing my Z-report with ST-05 transaction, the duration of Fetch column showing in pink color for analysing that i am selected and clik on explain above nothing is coming. What is the meaning of this and how to avoid this.

  • Re-submitting RSS after failed first attempt.

    I'm a newbie to RSS feeds. I  first submitted it when the RSS feed was filled with errors. However, iTunes still gave that confirmation screen saying it would look it over and email me with whether it is added or not.  It sent an email 5 hours later