Writing data in a File

When I got my output into a file each line has "OD" at the end . What is this ? and How can I fix it?
Thank you!!!

When you are writing in a file, which stream are you using? Character stream or byte stream? And after that, are you using the formatter class to format the output. Please give details.

Similar Messages

  • Problem while writing data on xls file using jxl API

    Hi,
    I am getting problem while writing data on excel file using jxl api.
    When i write data on file and all handles associated to the file are closed, file size increases but when i open the file nothing is written in it and when file is closed manually from excel window, file size decreased to its original that was before writing data.
    here is code:
              FileOutputStream os = new FileOutputStream(this.dirPath + this.fileName, true);
              WritableWorkbook this.workbook = Workbook.createWorkbook(os);
    after writing data following handler are closed:
    this.os.flush();
                        this.workbook.write();
                        this.workbook.close();
                        this.os.close();
                        this.os = null;
    can any body help me.
    Thanks in advance

    Err, I did help you. I did understand your problem; and I solved it for you. What was missing was that you apparently made no effort to understand what you were being told. Or even consider it. You just argued about it, as though you were the one with the solution, instead of the one whose code didn't work.
    And the other thing that was missing was the part where you said 'thank you' to me for solving your problem. Somewhat more appropriate than biting the hand that fed you, frankly. I do this for nothing, on my own gas, and it's extremely irritating when people keep asking about problems I have already solved for them. I am entitled to discourage that. It's part of making them more efficient actually.
    But it happens often enough that it also makes me think I'm just wasting my time. Probably I am.

  • Writing data to a file in Server

    Hi all,
    In my application i would be writing data to a file which is located in the Server.
    when i tried writing data to a file in my local machine using a Java Application it worked fine .
    Now through the webdynpro application and providing the files path (in server ) ,i am getting file not found exception .
    I am using basic File and i/o operations .
    File abc = new File ("
    servernamer
    folder1
    subfolder1
    filename.dat");
    when i try accessing this path from the command prompt its opening fine.
    Could you please through some light on this .
    thanks,
    swetha .

    >
    KalluriVijay wrote:
    > Hi Swetha,
    > Do one think.
    > InputStream text = null;
    >                int temp = 0;
    >                //File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());
    >                //wdComponentAPI.getMessageManager().reportSuccess("filePath Vijay:::"+file);     
    > //wdComponentAPI.getMessageManager().reportSuccess("filePath Vijay:::");
    >                     try
    >                     {
    >                     String fileName = wdContext.currentContextElement().getResource().getResourceName().toString();               
    >                     if(fileName.equalsIgnoreCase("ASNCRT.dat"))
    >                     {     
    >                     File file = new File(fileName);                         
    >                     FileOutputStream op = new FileOutputStream(file);          
    >                     if (wdContext.currentContextElement().getResource()!= null)
    >                     {
    >                     text = wdContext.currentContextElement().getResource().read(false);
    >                     while((temp=text.read())!= -1)
    >                     {
    >                     op.write(temp);
    >                     }
    >                     }
    >                     op.flush();
    >                     op.close();
    >                     path = file.getAbsolutePath();
    >                     //wdComponentAPI.getMessageManager().reportSuccess(path);
    >                     }
    >                     else
    >                     {
    >                     wdComponentAPI.getMessageManager().raiseException("Please Check the Filename:Filename should be ASNCRT.dat ",true);     
    >                     }
    >                     }
    >                     catch(Exception ex)               
    >                     {
    >                     ex.printStackTrace();
    >                     }
    > By using this code u can put u r file in to Server Path, then u will get the that .dat file from server path and run the command prompt its opening fine
    > How to get the file from the Server Path:
    > Workbook wb = Workbook.getWorkbook(new File(path));     // For get the file from the Server path
    >
    >   Hope this is help full for u
    > Regards
    > Vijay Kalluri
    This won't work. First, like i said, File class is not for accessing remote files, it is only for local files.
    Second, Workbook class is a class from Java Excel API. He is not working with xls. Anyway that wouldn't work either.

  • Writing Data to Multiple Files

    Hi,
    I got a problem while writing the data to multiple files.
    Actually my requirement is,
    I want to read the data from multiple files and retrieve the required data from those and save that data into separate files.
    Meaning if i read the data from "D:\kiran\kk\123\kiran.txt" the retrieved data should be saved in "D:\kiran\kk\kiran.txt" the file name should be created with the input file name.
    here is my code,
    //here i am taking the files into loop
    for(int i=0;i<files.length;i++){
    try{                   
    //reading the files
    BufferedReader br=new BufferedReader(new FileReader(files));
    //creating a new file for writing the retrieved data
    pw=new PrintWriter("D:\\Kiran\\kk"+File.separator.concat(str[i]));
    String line=br.readLine();
    while(line!=null){
    line=br.readLine();
    //here i am matching the required data
    Matcher m = Pattern.compile("name(\\s*\\W*\\w*\\W*.\\w*.)|invoice (\\W*(\\d+))|amount(\\W*(\\d+),\\d*)|site(\\s*Rs\\.[\\d]*,[\\d]*/-)", Pattern.CASE_INSENSITIVE).matcher(line);
    while(m.find()){                           
    System.out.println(m.group());
    //here printing the retrieved data to a file
    pw.println(m.group());
    br.close();
    but i am ending up with some issues.
    Data is reading properly from all the files, but when i write that data into individual files the data which is retrieved from last file is only printing into the file which is created last.
    Please help me regarding this,
    Thanks,
    Kiran

    D:\kiran\kk\123\
    In this folder some files are there say,
    kk.txt,kiran.txt,praveen.txt and so on, i can read the entire data from those files and also retrieving the required data like name,data etc. from all the files. Now the retrieved data should be stored in individual files means, if the data is retrieved from kk.txt then that particular data should be stored in the file with the same file name but in different location likewise it should happen for all the files those are in that folder.
    Thanks,
    Kiran

  • Writing Data to a file using TEXT_IO in Forms

    I have a situtation where i have 5 columns and having arabic as well as english data. when i want to write this data to a txt file using TEXT_IO in a specific format, it writes to a file but as soon as it finds an arabic field, it changes the posistion. how can i write to a txt file in the posistion i want???

    vaishnavinatarajan wrote:
    How to write data to a file without leaving any blank lines in the file? How to check if the cursor is placed in the corner of a notepad file using LAB VIEW?
    If you write data to a file, simply don't include any blank lines. We cannot give more specific advice unless you are telling us how you are writing. Are you writing to a new file or appending to an existing file. If the blank lines already exist, you need to read the entire file, remove the undesired lines from the string, and write the data back.
    Notepad files don't have any "corners". Please describe what you are trying to do.
    What is "LAB VIEW"?
    LabVIEW Champion . Do more with less code and in less time .

  • Problem in writing data to flat file

    Hi,
    I have created an interface with table as source and file as target. My interface is running from long time but its not writing data into file. Any clue?
    -Chikk

    Hi,
    Please, take a look if the target file is locked.
    Try to delete it and put the "Truncate" option from IKM to yes.
    Cezar

  • By a sub VI, Writing data countinously to file by a ''Write' button in Main VI??

    Good morning...day  to all !
    I've made a program, where I'm reading data generated by a device connected to a com port. These data are red from the port to an indicator buffer and then, into a file when a button, " write file" are pressed. I've placed the 'WriteDataToFile.VI' in a Sub VI placed in Main VI.
    When my Main Program starts and I switch a start button, a file dialog box opens, so I can choose an existing file or a new file to write data to!
    I want to Make a Button named  " Write file" so when pressed , the Dialog box opens and I can choose a file to write to.
    In that way I can avoid the Self pop up dialog box.
    I've spended the hole weekend  trying doing that, but no succes. The biggist problem by that is:
     To write a continously to a file I  also need to continously read the data from the port, And because of that, I got to write the data to a file as quickly as possible when Red from the port. So I gotta put the WriteDataToFile.VI 'sub', in the ReadData:vi 'Sub'. By that I always get the Dialog box poped up, by each while loop iteration. Just because the Software to the open Dialog Box (Write file), is placed in the ReadDataVI, Sub.
    Please Help me with that Guys , girls, any one, also peoble from Mars To!
    Attachements !!
    Regards
    H.F.Zamzam    
    HFZ
    Attachments:
    ReadDataWriteToFile.vi ‏62 KB

    Hi Zamzam,
    I think the point you should work on is the architecture of your whole application, LabVIEW has very well designed templates.
    If you go to new >> new... >> vi from template >> frameworks >> design pattern >> user interface event handler
    It is a very robust architecture with which you can draw cases for (almost) any kind of event such as a click on a button.
    in your application, you could choose the file to write on the first run, then put the file refnum in a shift register and add an event case handled by the "write to file" button that writes the acquired datas.
    You could even go further and set that "wite fo file" case on other event, for instance new data from the port com.
    wooopps... I tried to be as clear as I could but english is not my natural language , so please tell me you need some more help
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

  • Writing data in text file..

    1. check the file name in D:\\temp\\test.txt
    2. if it exists, then open file. if there is data, then read data. after the last record, it writes new data.
    3. if it does not exist, create text.txt file and write data into text.txt file.
    so far, I have a code..
    import java.io.*;
    import java.util.*;
    public class Main {
    public static void main(String[] args) {
    String filename="test";
    String format = "%1$-9s%2$-3s%3$-30s%4$-30s%5$-30s\n";
    String arraydata[] = { "John", "F.", "Kennedy", " ", "t", "John2", "F2.", "Kennedy2", " ", "t2"};
    String cnt_id ="2";
    int cnt_orderid = Integer.valueOf(cnt_id);
    try
    PrintStream ps = new PrintStream(new FileOutputStream("D:\\temp\\"+filename+".txt"));
    for (int i=1; i<cnt_orderid; i++)
    ps.println(String.format(format, (Object[])arraydata)); // write in test.txt file
    ps.close();
    catch (Exception e)
    System.out.println(e);
    my question is..
    1. how to check the file exists or not
    2. how to write the data in the new line after the last data in the file.

    1. Use a File object.
    File file = new File("someFile.txt");
    if (file.exists()) { ... }2. Consider using FileWriter; the constructor allows you to append to the end of the file:
    FileWriter fileWriter = new FileWriter(file, true);Michael

  • Writing data to log file

    Is it possible to write data to a log (text) file from within Crystal Reports, possibly in a UFL?  Is there a way that's already built in to CR?
    Thanks.
    Ron

    Ido - thanks for the link.  This will help.
    Don,
    Not exporting a report to a text file.  More like logging report events. One of my report developers was thinking of maybe tracking the start/stop times of each publication per person as well as the full run time.
    I hope I explained that correctly. 
    Thanks.
    Ron

  • Somebody experience with writing data in Access file?

    I want to write my data in a Access file.
    Is it true, that I have to create a macro in the Access-file?
    I have no experience with macros. Can somebody tell me how I can do that?
    Has somebody an example?
    Thanks for help.

    No, you don't have to write a macro. I guess you're refering to the shipping example that uses DDE. Instead of DDE, you can use ActiveX. There have been several examples posted to the forum that use this to read and write from an Access database. There is also the Database Connectivity Toolkit from NI that uses ODBC/ADO/SQL to talk to any database. For a free utility, check out LabSQL from Jeffrey Travis at http://jeffreytravis.com/lost/download/.

  • Writing data in text file in KM

    Hi Experts,
    I am trying to write content in KM. my query is
    1) I tried with FileManagement, But it doesnn't work in KM. Why?? working well with file saved on server.
    2) I tried following code. But there in no exception,error and no result...
    try{
         String upstr="some data";
         IUser user =WPUMFactory.getUserFactory().getEP5User(req.getUser());
         ByteArrayInputStream data = new ByteArrayInputStream(upstr.getBytes());
         Content content = new Content(data,"text,plain",data.available()); //test
         ResourceContext ctxt = new ResourceContext(user);
         RID rid =RID.getRID("/documents/test.txt");
            ResourceFactory.getInstance().getResource(rid, ctxt).updateContent(content);
    }catch(Exception e){}
    Can you help please??
    Thanks in advance.
    Regards,
    Mehul

    Hi Mehul,
    -->I tried with FileManagement, But it doesnn't work in KM. Why?? working well with file saved on server.
    It is unclear what type of Repository you are using/having (FSDB/Webdav) and what you are trying to do!
    http://help.sap.com/saphelp_nw2004s/helpdata/en/62/468698a8e611d5993600508b6b8b11/frameset.htm
    --> I tried following code. But there in no exception,error and no result
    Use the below code to get things working
    public static IResource getOrCreateResource(String name, IResourceContext resourceContext)
            throws ResourceException {
            if (name != null) {
                name = name.trim();
            // Check that no part of the name has leading or trailing spaces / underscores
            RID collectionRID = RID.getRID(name);
              IResource collection = null;
              if (!ResourceFactory.getInstance().checkExistence(collectionRID, resourceContext)) {
    //In this method, passing true will create new Resource if not exists
                   collection = (IResource) ResourceFactory.getInstance().getResource(collectionRID, resourceContext, true);
              }else{
                   collection = (IResource) ResourceFactory.getInstance().getResource(collectionRID, resourceContext, false);
      return collection;
    IResource resource = getOrCreateResource(String name, IResourceContext resourceContext)
    String dataString = new String(content);
    ByteArrayInputStream dataStream = new ByteArrayInputStream(dataString.getBytes());
    IContent newContent = new Content( dataStream, text/plain, dataStream.available() );
    resource.updateContent(newContent);
    Also check this:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0ab890-0201-0010-849d-98d70bd1d5f0
    Greetings,
    Praveen Gudapati
    p.s. Points are always welcome for helpful answers

  • Streaming data and writing data to measurement file problem

     Hi everyone,
    I found something wrong about my code but i don't know exactly what it is first i have a program for acquiring 15 analog signals(NI PXI6259) after acquiring the data i use network stream to stream data from my NI PXI8186 to the host pc these steps are in target VI, after streaming data to host PC
    , i tried to write down the data to the spreadsheet using Express write to measurement VI.
    Problems : 1. After i run the host Vi and target Vi the number available to read is always 0 after sometimes the data displaying on the chart incdicator on host Vi is stopped and start counting the numberavailable to read also the time indicated on X axis of the chart doesn't grow.
                         2. Write to measurement file generate the file that record the data counting the data from 0 to 99 and start over and over again
     Please help i really have no idea what is the cause for each problems.
    Attachments:
    target - single rate.vi ‏83 KB
    Host UI.vi ‏36 KB

    Dear Crossrulz
            Thank you for your prompt reply i have removed the input to "Samples Per Channel" on the DAQmx Timing VI already but still didn't arrange the 
    channels input i will do it but i want to keep it this way first. Now the data acquiring looks okay but i have found new problem.
            After running the program for acquiring the data for about 5 to 6 minutes the program will stop acquiring the data or
    sometimes the target (NI pxi8186) will reboot itself and displaying message "Reboot due to system error" "System state: Safe Mode (System error)
    and on the Host PC there will be a window pop-up displaying
    "Waiting for the target (NI-PXI8186-2F0a597C) to respond"  "Stop Waiting and Disconnect"
     i didn't run the host Vi just run the target Vi only. If this problem caused from the program or the hardware ? Please help.
    Attachments:
    Host UI.vi ‏141 KB
    target - single rate.vi ‏83 KB

  • Writing data  in Excel file

    hi,
    i want to write the output of my jsp in an excell sheet. anybody teell me the way and the source code for this. Thanks in advance
    Sathaa

    Check out
    org.apache.poi
    it has a lot of tutorials on how to use excell with java

  • Error writing data in a flat file using UTL_FILE feature

    Hi All,
    I have written a package which fetches data from four different cursors and inserts into a temporary table.
    Now this temporary table is used to write data in a file using the UTL_FILE feature.
    fhandler :=
    UTL_FILE.fopen (l_path,'Demand_Transactions_'
    || TO_CHAR (SYSDATE, 'YYYYMMDDHH24MI')
    || '.txt',
    'w',
    max_linesize => 32767
    This table has 62593 records and when it starts writing data into the file from the table it errors out after writing 30045 records with the error - ORA-01722: invalid number.
    Can anyome please advise me is it because of the max_linesize => 32767. If not then what can be the possible reason.
    Any help in this would be highly appreciated.
    Regards,
    Shruti

    891330 wrote:
    Hi All,
    I have written a package which fetches data from four different cursors and inserts into a temporary table.
    Now this temporary table is used to write data in a file using the UTL_FILE feature.
    fhandler :=
    UTL_FILE.fopen (l_path,'Demand_Transactions_'
    || TO_CHAR (SYSDATE, 'YYYYMMDDHH24MI')
    || '.txt',
    'w',
    max_linesize => 32767
    This table has 62593 records and when it starts writing data into the file from the table it errors out after writing 30045 records with the error - ORA-01722: invalid number.
    Can anyome please advise me is it because of the max_linesize => 32767. If not then what can be the possible reason.Max linesize is the number of characters in a line before a newline has to be issued, not the number of rows written.
    The error would indicate that you have a character to number conversion going on somewhere but the characters are not numeric so it's failing that conversion.
    This doesn't sound like a UTL_FILE issue, but more to do with how you are building up your strings to output to the file.
    You would need to show us your code that builds up the lines you are writing out, with details of the datatypes of any of the columns/variables included in that.

  • Writing data to New Line in a File

    Hi guys,
    Im writing data to a file, i want to write data on different lines, not contineously.
    My code is writing the data but not the next line.
    Please Help. My code is below :
    fw = new FileWriter(filename,append);
    fw.write(cur_timestamp().toString());
    fw.write("\n");
    error_data = errorCode + "     " + msg;
    fw.write(error_data.toString());//appends the string to the file
    fw.write("\n");Thanks
    Rebekah

    You'd still want to use the System property, because other editors might display it correctly, but for the Windows platform, it's acctually incorrect behavior. The separator would be "\r\n". I think on a Mac, it'd be "\r" - so your program would fail again there.

Maybe you are looking for

  • When I try to download Adobe Flash Player, it says I need to quit out of Safari even when it's closed. How do I fix this?

    When I try to download Adobe Flash Player, it says I need to quit out of Safari even when it's closed. How do I fix this?

  • Newbee,Having problem with submit button

    Hi All, I am very new to servlet.I am trying to delete record from my list which i am loading and showing from same servlet.It is compiling fine but when I press delete button it is not deleting the record.I don't know what's wrong with it? After del

  • How to Display infotype in Portals?

    Hi All,   I have a requirement where i have to display infotype. For this i created transactional iview( tcode:pa20) but i must not display the selection screen for the employees. When the Employees login and click the link, they should be able their

  • Can anyone make genius playlist from 2011 songs?

    I have tried to create genius playlists from very popular songs this year including "Party Rock Anthem" by LMFAO & "Pumped Up Kicks" by Foster the People. I doubt that Apple Genius Servers do not have information to create genius playlists to these s

  • Unable to sync Group calender

    I have created a calender in sharepoint 2013. I am able to see group members of mine. When I go to day,week,month view it is showing first person Calender. If I try to sync to outlook It is syncing only the person calender. Can Any one help me regard