Writing file output on arbitrary lines

Hi,
I'd like to know whether it is possible to select the line number on which I am writing the next output string when making a .txt or .csv file.
Background: I am writing a survey, for which I need to record people's responses. The survey questions will be presented in random order. However, I want the text file output to show the responses in the same order for everyone.
So if a person sees the survey questions in the order CBDAE, and replies "green" "no" "cheese" "yes" "true", I want the output file to read
A "yes"
B "no"
C "green"
D "cheese"
E "true"
Currently I'm using a buffered file writer to write the responses:
BufferedWriter out = new BufferedWriter(new FileWriter("outfilename"));
out.write(response);
out.close();What would be the best way to change things so that I can pick which line I write to?
Thanks!

Hmmm... Ok. Will it it safe to assume that writing a
couple hundred integers to a text file at once should
be pretty safe and quick on any computer?I don't know what you mean by "safe."
It should be fast, but fast is a very subjective and context-sensitive term. Try it and see if it's fast enough for you.

Similar Messages

  • What are the cases that cause the I/O error writing to output file

    may i ask what are the cases that cause the I/O error writing to output file ??
    cause i have the write path and the input file has data
    any ideas???

    and the permission is to write first time then append to itBy "permission" is meant the operating system controlled rights that let
    particular users do specified things with specified files or directories.
    the error message is a the title of the message
    I/O error writing to output fileThe java runtime actually creates a much more useful error message than
    this but, unfortunately, your program is swallowing this error message and
    replacing it with the message you see.
    Somewhere in your code you have something like:try {
        // all sorts of stuff goes here
        // including the code that is intended to
        // write to the file
    } catch(IOException ioe) {
        System.out.println("I/O error writing to output file");
            // add this line
        //ioe.printStackTrace();
    }It might say Exception rather than IOException.
    To get a much more useful error message add the commented line.

  • How to run multiple java files concurrently using command line?

    Hi,
    I have to write a script to run multiple java files and c files concurrently. Say, A and C are java files and B is another binary executable file, I have to make sure they are run in the order A-B-C, then I was trying to run by using
    java A & ./B & java C
    But it turned out that B could run before A started... Is there any way that I can ensure that A runs before B, and B runs before C by using the command line?
    Thanks a lot.

    GKY wrote:
    Sorry, I didn't make my question clear enough...
    A has to give some output files that B needs to get started,Then B can start at any time--even before A--and just wait for those files to be written. For instance, A could write to a temp file, then rename it to the real name. However, if there are multiple files, and they all have to exist, even this won't necessarily work. There are other approaches that will though.
    although writing the output takes very short time,Depends on when the OS decides to give A CPU time, what else is going on on that disk controller and/or network, etc.
    B could still run before A finishes the writing, As it can if you sleep for 1, or 10, or 1,000,000 seconds before starting B.
    if B can't find the info it wants, it fails to move on. That's why I need to make sure A starts before B.No, you need to make sure A's data is there before B tries to use that data.
    Edited by: jverd on Jul 29, 2008 1:06 PM

  • Executing a jar file from an arbitrary folder

    I got a small problem in detemining the path of my application's jar file. I am starting the application by executing a batch, lets say MyApp.bat (using it on windows and unix), this batch file consists of one line 'java -jar MyApp.jar', MyApp.jar being in the same folder.
    Now lets say MyApp.bat and MyApp.jar are in folder 'A' and my current working directory is a parallel folder 'B', so I can invoke the batch file from there(!) by executing '../A/MyApp.bat'. But now the VM tries to find MyApp in the current working directory which is still 'B' and not 'A'. A simple solution would be to use a script which determines the directory of MyApp.jar and include the generated path in the call to the VM (I didn't try yet, but I guess this will awkward doing it on windows)
    Since I don't think I am the first person executing a java program via a script from an arbitrary folder in a file system, I hoped that there might be a more elegant way. Unfortunately I couldn't find another solution yet.
    Regards,
    Stefan

    In MyApp.bat your line should read (NT/2K/XP/2003/Vista):java -jar "%~dp0MyApp.jar"Regards

  • Need a VB-Script that read a txt-file and only the lines that are new since last time

    Hi,
    I need help to write a VB script that read all new lines since the last time.
    For example:  The script reads the textfile at specific time, then 10 minutes later the script read the file again, and it should now only read the lines that are new since last time. Anyone that has such a script in your scriptingbox?
    cheers!
    DocHo
    Doc

    Based on the excellent idea by Pegasus, where is a VBScript solution. I use a separate file to save the last line count read from the file, then each time the file is read I update the line count. Only lines after the last count are output by the program:
    Option Explicit
    Dim strFile, objFSO, objFile, strCountFile, objCountFile, strLine, lngCount, lngLine
    Const ForReading = 1
    Const ForWriting = 2
    Const OpenAsASCII = 0
    Const CreateIfNotExist = True
    ' Specify input file to be read.
    strFile = "c:\Scripts\Example.log"
    ' Specify file with most recent line count.
    strCountFile = "c:\Scripts\Count.txt"
    ' Open the input file for reading.
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(strFile, ForReading)
    ' Check if the line count file exists.
    If (objFSO.FileExists(strCountFile) = False) Then
        ' Initial count is 0, so all lines are read.
        lngCount = 0
    Else
        ' Open the line count file.
        Set objCountFile = objFSO.OpenTextFile(strCountFile, ForReading)
        ' Read the most recent line count.
        Do Until objCountFile.AtEndOfStream
            lngCount = CLng(objCountFile.ReadLine)
        Loop
    End If
    ' Read the input file.
    lngLine = 0
    Do Until objFile.AtEndOfStream
        ' Count lines.
        lngLine = lngLine + 1
        strLine = objFile.ReadLine
        If (lngLine >= lngCount) Then
            ' Output the line.
            Wscript.Echo strLine
        End If
    Loop
    ' Close all files.
    objFile.Close
    If (lngCount > 0) Then
        objCountFile.Close
    End If
    ' Ignore last line of the file if it is blank.
    If (strLine = "") Then
        lngLine = lngLine - 1
    End If
    ' Save the new line count.
    Set objCountFile = objFSO.OpenTextFile(strCountFile, _
        ForWriting, CreateIfNotExist, OpenAsASCII)
    objCountFile.WriteLine CStr(lngLine + 1)
    objCountFile.Close
    Richard Mueller - MVP Directory Services

  • PBDOM : Exporting to XML file gives a single line

    I've been starting developing with PowerBuilder 12.5 a few weeks ago. I had to write some XML files, so I got familiar with the PBDOM library.
    I can build a lot of different things, it's very nice, but one thing still bothers me :
    In the output file, the whole XML is written on a single line.
    I use the SaveDocument function.
    For example, here is some code :
    PBDOM_Document doc
    PBDOM_Element noderoot, node1, node11, node12
    doc = CREATE PBDOM_Document
    doc.NewDocument("NodeRoot")
    noderoot = doc.GetRootElement()
    node1 = CREATE PBDOM_Element
    node1.SetName("Node1")
    noderoot.AddContent(node1)
    node1.SetAttribute("Attr", "AttrValue")
    node11 = CREATE PBDOM_Element
    node11.SetName("Node11")
    node11.AddContent("Here is a value")
    node1.AddContent(node11)
    node12 = CREATE PBDOM_ELEMENT
    node12.SetName("Node12")
    node12.AddContent("Here is another value")
    node1.AddContent(node12)
    doc.SaveDocument("myDoc.xml")
    Here is the result when I open it with notepad++
    <NodeRoot><Node1 Attr="AttrValue"><Node11>Here is a value</Node11><Node12>Here is another value</Node12></Node1></NodeRoot>
    Whereas I wanted :
    <NodeRoot> <Node1 Attr="AttrValue"> <Node11>Here is a value</Node11> <Node12>Here is another value</Node12> </Node1> </NodeRoot>
    With the notepad++ XML tools plugin, I can use the "pretty print" function to get this nice representation. But I would like my file to be formatted this way from the beginning. I noticed that the "line ending" was set to UNIX format (indicator on bottom right of the window), but I'm working on Windows. When I use the menu to convert it to Windows format (CR+LF), it changes this indicator, but the code stays on one single line.
    Is there a way to tell PBDOM to export the XML file with a nice output ?
    Thank you !
    Notes :
    - Opening the XML file with Internet Explorer or Google Chrome gives me a nice vizualisation, with indentation, line breaks...
    - Adding a <?xml version="1.0" encoding="ISO-8859-1" ?> does not help (I've been doing it while exporting some more complex files, but I still get the output on one line...)

    Here is a very simple powerbuilder example. It uses MSXML instead of PBDOM. See my comments for hints how to use it with PBDOM.
    oleobject lole_dom, lole_root, lole_element1, lole_element11, lole_element12
    oleobject lole_Writer, lole_saxreader
    string ls_result
    // build DOM (you don't need this if you use PBDOM)
    lole_dom = create oleobject
    lole_dom.ConnectToNewObject ("Msxml2.DOMDocument")
    lole_root = lole_dom.CreateElement ("NodeRoot")
    lole_dom.documentElement = lole_root
    lole_element1 = lole_dom.CreateElement("Node1")
    lole_root.AppendChild(lole_element1)
    lole_element1.SetAttribute("Attr", "AttrValue")
    lole_element11 = lole_dom.CreateElement("Node11")
    lole_element11.AppendChild (lole_dom.CreateTextNode("Here is a value"))
    lole_element1.AppendChild(lole_element11)
    lole_element12 = lole_dom.CreateElement("Node12")
    lole_element12.AppendChild (lole_dom.CreateTextNode("Here is another value"))
    lole_element1.AppendChild(lole_element12)
    // this saves the DOM without formatting
    //lole_dom.save ("d:\testxml.xml")
    // this part is for formating
    lole_Writer = create oleobject
    lole_saxreader = create oleobject
    lole_Writer.ConnectToNewObject ("MSXML2.MXXMLWriter")
    lole_saxreader.ConnectToNewObject ("MSXML2.SAXXMLReader")
    lole_Writer.omitXMLDeclaration = True
    lole_Writer.indent = True
    lole_saxreader.contentHandler = lole_Writer
    // instead of DOM you can also put a XML string to parser: lole_saxreader.parse ("<node>...</node>")
    // so you can also use the PBDOM output directly
    lole_saxreader.parse (lole_dom)
    // here is your formatted output
    ls_Result = lole_Writer.output
    MessageBox ("", ls_result)
    lole_writer.Disconnectobject( )
    lole_saxreader.Disconnectobject( )
    lole_dom.Disconnectobject( )
    DESTROY lole_writer
    DESTROY lole_saxreader
    DESTROY lole_dom

  • Advice on constructing a test engine and formatting a spreadsheet test file to perform command line interface testing on a product through telnet or serial interface

    Advice on constructing a test engine and formatting a spreadsheet test file to perform command line interface testing on a range of products through telnet or serial interface and output pass/fail results.

    If I understand correctly, you want to do the following:
    1. Create one or more tab-delimited files that specify a series of query strings (that LabVIEW will send to your products) and expected reply strings (that LabVIEW will look for in response to each query)
    2. Run your LabVIEW program (the test engine) and have it execute one or more test scripts from file using either TCP/IP or serial communication to your units under test
    3. Track how many of the queries are met with the expected response, and output an indication of whether each step passed or failed
    If this is close to correct, then I've attached a sample test file and LabVIEW VI as an example; I chose the TCP/telnet method because it allowed me to use the ni.com Web site to simulate my tes
    t hardware. If you happen to own the LabVIEW Internet Toolkit, there's a VI called "Telnet Play Script" in the Telnet palette that does something fairly similar using TCP. The same general model would also work for Serial communications.
    Hope it helps,
    John Lum
    Attachments:
    test_engine.zip ‏24 KB

  • Advice on constructi​ng a test engine and formatting a spreadshee​t test file to perform command line interface testing on a product through telnet or serial interface

    Advice on constructing a test engine and formatting a spreadsheet test file to perform command line interface testing on a range of products through telnet or serial interface and output pass/fail results.

    Hello j. smith,
    TestStand gives you the ability to create "sequence files" which are lists of tests to be run sequentially or in parallel. These tests can be written in any language: LabVIEW VIs, C/C++ DLLs, EXEs, ActiveX objects, .NET Assemblies, etc.
    You can run your TestStand sequence files from a command-line prompt using the following syntax:
    \bin\SeqEdit.exe" /quit -run
    This will launch the TestStand Sequence Editor (and optionally prompt you for TestStand login information if you have this configured), run your sequence file, then exit.
    If you're using the TestStand process model, it can output your results to a report file or database if you configure this. To use a TestStand process mo
    del to execute your sequence file, use the following syntax:
    \bin\SeqEdit.exe" /quit -runEntryPoint
    Here's an example:
    C:\>"C:\Program Files\National Instruments\TestStand 3.0\bin\SeqEdit.exe" /quit -runEntryPoint "Single Pass" "C:\Program Files\National Instruments\TestStand 3.0\Examples\Demo\C\computer.seq"
    Note that multiple sequences and sequence files can be specified on the command line.
    TestStand supports remote sequence execution using DCOM (Distributed COM), which is an east way to remotely execute tests. But as for running tests or commands through a telnet or serial interface, you would have need to check Windows documentation on how to execute command-line remotely like this.
    David Mc.
    NI Applications Engineer

  • Connection refused Error while writing file to FTP server.

    Hi All,
    We got below error while writing file to FTP server. Any one have any idea on this?
    sABCS_1.0_8e88588d4fb54ebd2ac7ef66c8421d52.tmp/writeEncryptedFile.wsdl [ Put_ptt::Put(opaque) ] - Could not invoke operation 'Put' against the 'FTP Adapter' due to:
    ORABPEL-11429
    Error sending file to FTP Server.
    Unable to send file to server. [Caused by: Connection refused]
    Please ensure 1. Specified remote output Dir has write permission 2. Output filename has not exceeded the max chararters allowed by the OS and 3. Remote File System has enough space.

    Hmmm ...
    Same issue as your post from three months' earlier?
    Re: Error while putting file in sftp location.

  • How to scan/ read a text file, pick up only lines you wanted.

    I'm new to Labview, I trying to wire a VI which can read a text file
    example below:
    Example: My Text File:
    1 abcd
    2 efgh
    8 aaaa
    1 uuuu
    and pick out only any line which start with number 1 (i.e 1 abcd)
    then output these 2 lines out to a a new text file?
    Thanks,
    Palmtree

    Hi,
    How do you creat your text files? Depending on the programm, there is added characters in the beginning and at the and of the file. So here you will find a VI to creat "raw" text files.
    To debug your VIs, use the probs and breakpoints, so you can solve the problem by your self or give an more accurate description of it.
    There is also the VI that read a integer and two strings  (%d %s %s)
    Attachments:
    creat text file.vi ‏9 KB
    read_from_file.vi ‏14 KB

  • Copy one text file to another text file and delete last line

    Hi all wonder if someone can help, i want to be able to copy one text file to another text file and remove the last line of the first text file. So currently i have this method:
    Writer output = null;
             File file = new File("playerData.xml");
             try {
                   output = new BufferedWriter(new FileWriter(file, true));
                   output.write("\t" + "<player>" + "\n");
                   output.write("\t" + "\t" + "<playerName>" + playerName + "</playerName>" + "\n");
                   output.write("\t" + "\t" + "<playerScore>" + pointCount + "</playerScore>" + "\n");
                   output.write("\t" + "\t" + "<playerTime>" + minutes + " minutes " + seconds + " seconds" + "</playerTime>" + "\n");
                   output.write("\t" + "</player>" + "\n");
                   output.write("</indianaTuxPlayer>" + "\n");
                  output.close();
                  System.out.println("Player data saved!");
             catch (IOException e) {
                   e.printStackTrace();
              }However each time the method is run i get the "</indianaTuxPlayer>" line repeated, now when i come to read this in as a java file i get errors becuase its not well formed. So my idea is to copy the original file, remove the last line of that file, so the </indianaTuxPlayer> line and then add this to a new file with the next data saved in it. So i would end up with something like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <indianaTuxPlayers>
         <player>
              <playerName>Default Player</playerName>
              <playerScore>0</playerScore>
              <playerTime>null minutes null seconds</playerTime>
         </player>
         <player>
              <playerName>Default Player</playerName>
              <playerScore>0</playerScore>
              <playerTime>null minutes null seconds</playerTime>
         </player>
         <player>
              <playerName>Default Player</playerName>
              <playerScore>0</playerScore>
              <playerTime>null minutes null seconds</playerTime>
         </player>
    </indianaTuxPlayers>
    However after all day searching the internet and trying ways, i have been unable to get anything working, could anyone give me a hand please?

    I would go the XML route too, but for fun, open a file as a BufferedWriter and do this:
    void copyAllButLastLine(File src, BufferedWriter tgt) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader(src));
        try {
            String previous= in.readLine();
            for (String current = null; (current = in.readLine()) != null; previous=current) {
                tgt.write(previous);
                tgt.newLine();
        } finally {
            in.close();
    }

  • Uploaded text file has a new line added at the top using BSP MVC applicatio

    I have a BSP MVC application that uploads data on to the application server. When I open the uploaded text file, the very first line on the file looks like the line below. ->
    htmlb:button:click:nullhtmlb_form_1UploadUpload0htmlbdfsdf
    But the rest of the file looks okay. This is causing other than .txt files to get corrupted.
    Here is the code from my DO_HANDLE_EVENT.
    data: entity   type ref to if_http_entity,
          name     type string,
          content  type xstring,
          content_type type string,
          idx      type i value 1,
          v_root(26) value '
    houappl131\SRM_Download\',
          v_unxfile(100),
          v_transfer type xstring,
          v_type(6),
          v_len type i,
          v_dirfile type zfileinfo,
          v_ofile(80),
          v_guid type guid_32.
      class cl_htmlb_manager definition load.
      data:        v_asn(10) type n.
      data: fu        type ref to cl_htmlb_fileupload,
                       file_id   type string value 'batchfile'.
      data: o_page_context type ref to if_bsp_page_context.
      data: parent type ref to cl_bsp_controller2,
            lo_model                       type ref to cl_sus_m_asn_detail.
      o_page_context = me->get_page_context( ).
      cl_htmlb_manager=>dispatch_event_ex( request = request
      page_context = o_page_context
      event_handler = me ).
      refresh z_batch->message.
      if htmlb_event->server_event = 'Upload'.
        fu ?= cl_htmlb_manager=>get_data( request = request id = file_id name
                                             = 'fileUpload' ).
        if fu->file_name gt space.
              z_batch->parameters-fpath = fu->file_name.
              v_len = strlen( z_batch->parameters-fpath ).
              if v_len gt 4.
                v_len = v_len - 3.
              endif.
              v_type = z_batch->parameters-fpath+v_len(3).
              search z_batch->parameters-fpath for '.'.
              if sy-fdpos gt 0 and v_len gt 0.
                v_len = v_len - sy-fdpos.
                v_type = z_batch->parameters-fpath+sy-fdpos(v_len).
              endif.
              clear v_asn.
              v_asn = z_batch->parameters-asnhdr.
              concatenate v_asn
                          z_batch->parameters-asnitem
                          z_batch->parameters-batch
                          v_type
                          into v_unxfile separated by '.'.
              concatenate v_root v_unxfile into v_unxfile.
              condense v_unxfile no-gaps.
              open dataset v_unxfile for output in binary mode.
                while idx <= request->num_multiparts( ).
                  entity = request->get_multipart( idx ).
                  name = fu->file_name .
                  if name is not initial.
                    content_type = entity->get_header_field( 'Content-Type' ).
                    clear content.
                    content      = entity->get_data( ).
                    v_transfer = content.
                    transfer content to v_unxfile.
                    append content to z_batch->filetab.
                  endif.
                  idx = idx + 1.
                endwhile.
                close dataset v_unxfile.
            endif.
      endif.
    Here is my fileupload button in the view
    <htmlb:page title="File Upload " >
        <htmlb:form method       = "post"
                    encodingType = "multipart/form-data" >
          <htmlb:label id     = "Batchnum"
                       design = "Label"
                       for    = "Batchnumber"
                       text   = "Batch" />
          <htmlb:inputField id    = "Batchinput"
                            value = "//zbatch/parameters.batch" />
          <htmlb:fileUpload id="batchfile" />
          <htmlb:button id      = "Upload"
                        text    = "Upload"
                        onClick = "Upload" />
          <htmlb:button id      = "Close"
                        text    = "Close window"
                        onClick = "Close" />
    Any of you gurus know why this is happening?

    I solved it myself

  • Unwanted / Special Characters in XML File Output

    Hello Seniors,
    I am downloading an XML File which has some code from include's. The XML file is well formatted and the output is fine when I downloaded programs. But this include is from user exits and the code has some commented lines in it also with a blank line in between. Now the problem is that I am getting a "VT" in the XML file which is an unwanted character where there is a blank line in the include "ZXRSAU01". Other than this include, all other includes are downloaded fine.
    Here is the code from the include "ZXRSAU01":
         select single * from knvv where kunnr = l_s_icctrcst-kunnr
                                    and  vkorg = l_s_icctrcst-vkorg
                                    and  vtweg = l_s_icctrcst-vtweg
                                    and  spart = l_s_icctrcst-spart.
    Here is the output in the XML File:
         select single * from knvv where kunnr = l_s_icctrcst-kunnr
                                    and  vkorg = l_s_icctrcst-vkorg VT
                                    and  vtweg = l_s_icctrcst-vtweg
                                    and  spart = l_s_icctrcst-spart.
    Please give me a solutions for this. Each of your answers are very important and will addressed with the best deserved.
    Thanks and regards,
    Chaitanya.

    Hello Madhan,
    Firstly, Thank You for the reply. We cannot remove the space in that include because the system is not the original system. Please let me inform you that this is a 4.6C system. We have used CDATA to get the code as it is onto the XML file. I observed that, firstly, the character "#" has come into the internal table with the read report itself. In the debug I saw it to be "0B" in the binary format, but in the downloaded XML file output, it is displayed as "VT". Please let me know how to get rid of this special/unwanted character.
    Thanks and regards,
    Chaitanya.

  • Problem writing file to FTP

    whan i am writing the file to FTP in foreground it is working fine.but in backgruond it is failing .what would be the problem...

    i using the below code..
    FORM ftpfinanceaccess_download USING    p_host
                                            p_user
                                            p_password.
      DATA  :
              dest LIKE rfcdes-rfcdest VALUE 'SAPFTP',
              compress TYPE c VALUE 'N',
              host(64) TYPE c.
      DATA: hdl TYPE i.
      DATA: BEGIN OF result OCCURS 0,
            line(100) TYPE c,
            END OF result.
      DATA : key TYPE i VALUE 26101957,
             dstlen TYPE i,
             blob_length TYPE i.
      host = p_host .
      DESCRIBE FIELD p_password LENGTH dstlen IN CHARACTER MODE.
      CALL 'AB_RFC_X_SCRAMBLE_STRING'
        ID 'SOURCE'      FIELD p_password    ID 'KEY'         FIELD key
        ID 'SCR'         FIELD 'X'    ID 'DESTINATION' FIELD p_password
        ID 'DSTLEN'      FIELD dstlen.
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          user            = p_user
          password        = p_password
          host            = host
          rfc_destination = dest
        IMPORTING
          handle          = hdl
        EXCEPTIONS
          not_connected   = 1
          OTHERS          = 2.
      IF sy-subrc = 0.
        CONCATENATE 'cd' ftppath INTO ftppath SEPARATED BY space .
        CALL FUNCTION 'FTP_COMMAND'
          EXPORTING
            handle        = hdl
            command       = ftppath
          TABLES
            data          = result
          EXCEPTIONS
            command_error = 1
            tcpip_error   = 2.
        IF sy-subrc = 0 .
          CLEAR result .
          REFRESH result .
          CALL FUNCTION 'FTP_COMMAND'
            EXPORTING
              handle        = hdl
              command       = 'ascii'
            TABLES
              data          = result
            EXCEPTIONS
              command_error = 1
              tcpip_error   = 2.
          IF sy-subrc = 0 .
            DESCRIBE TABLE iresult LINES lines.
            blob_length =  lines * width .
            clear : lines.
    Delete the existing file
         CONCATENATE 'del' ftpfile INTO delfile SEPARATED BY SPACE.
          CALL FUNCTION 'FTP_COMMAND'
            EXPORTING
              handle        = hdl
              command       = delfile
            TABLES
              data          = result
            EXCEPTIONS
              command_error = 1
              tcpip_error   = 2.
    *End of deleting the existing file
            CALL FUNCTION 'FTP_R3_TO_SERVER'
              EXPORTING
                handle        = hdl
                fname         = ftpfile
                blob_length   = blob_length
                CHARACTER_MODE = 'X'
              TABLES
                TEXT          = iresult
              EXCEPTIONS
                TCPIP_ERROR   = 1
                COMMAND_ERROR = 2
                DATA_ERROR    = 3
                OTHERS        = 4.
            IF sy-subrc <> 0 .
              WRITE 'Error in writing file to ftp' .
            ELSE.
              WRITE 'File downloaded on the ftp server successfully'.
            ENDIF.
          ENDIF.
        ELSE.
          WRITE : 'Path on ftp not found : ' , ftppath .
        ENDIF.
        CALL FUNCTION 'FTP_DISCONNECT'
          EXPORTING
            handle = hdl.
        CALL FUNCTION 'RFC_CONNECTION_CLOSE'
          EXPORTING
            destination = 'SAPFTP'
          EXCEPTIONS
            OTHERS      = 1.
      ELSE.
        WRITE 'Could not connect to ftp' .
      ENDIF.

  • Running jar files from the command line

    I have always felt it would be useful to run a jar file from th command line in EXACTLY the same way as an EXE. On some systems, typing MYAPP.JAR will run the app, but doesn't output and command line data, so it only works for GUI apps. I've come up with a tiny C program that runs java -jar xxxx.jar for you.
    #include <stdio.h>
    #include <string.h>
    #include <process.h>
    void main(int argc,char *argv[])
         char cmd[1024];
         strcpy(cmd,"java -jar ");
         strcat(cmd,argv[0]);
         strcat(cmd,".jar");
         for(int arg=1;arg<argc;arg++)
              strcat(cmd," ");
              strcat(cmd,argv[arg]);
         system(cmd);
    }Simply compile this to an exe, rename the exe to the name of your jar file and put it in the same directory. Then just type 'MyJarFile' (no jar extension) and it should run. It passes all command live args as well. Comments ?

    Here's a better version. The JAR and the EXE can be anywhere in the PATH:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <process.h>
    void main(int argc,char *argv[])
         char jar[1024];
         char cmd[1024];
         strcpy(cmd,argv[0]);
         strcat(cmd,".jar");
         _searchenv(cmd,"PATH",jar);
         strcpy(cmd,"java -jar ");
         strcat(cmd,jar);
         for(int arg=1;arg<argc;arg++)
              strcat(cmd," ");
              strcat(cmd,argv[arg]);
         system(cmd);
    }

Maybe you are looking for

  • I cant delete Mozilla History file. I follow all the guidelines but it will not delete it

    My Mozilla keeps all the History even up to past June and it will nto let me delete them no matter what i do. I follow the process described below but it will nto work. Even when i open the History pane on the left side, it will not let me delete the

  • Question about windows printer canon bj5200 can't print or see in Leopard

    Hello; this has been a problem for me in Tiger as well, I have a windows workgroup network and have a canon bj5200 share on a windows xp machine, I've done some research and can't seem to find the solution on how print from Leopard (previous Tiger) t

  • Want to move photos to external hard drive

    Here is my situation. I have used iPhoto before abd gave more than one iphoto library on my hard drive. I want to move all of my pictures onto an external drive so I have them all in one place. I then want to delete all the photos on my hard drive so

  • Streaming video and bluetooth stereo

    I have the Blackberry Curve with T-Mobile with v4.5.0.81 and the Motorola HT820 stereo bluetooth headset.  I am able to listen to regular music and videos on the microsd card on the HT820, but when I play streaming video online there isn't an option

  • Thread pool Question

    Hi, Can any one please guide me How do I create a thread pool? Regards, Rajesh Kannan. N