Multiple Strings as Commandline argument

Hello people,
Everything is working properly, but I have a problem starting a method via command line argument.
int main(int argc, char** argv)
     char  *p2Jar =     "-Djava.class.path=C:\\path\\myJAR.jar";
     char  *p2Lib =     "";
     JNI_IF JNIInterfaceObj(p2Jar, p2Lib);
     JNIInterfaceObj.setClassName("package/depth/MyClass");;
     JNIInterfaceObj.setMethodName("main");
     JNIInterfaceObj.getVM()->DestroyJavaVM();
     return 0;
void JNI_IF::setMethodName(char* methodName)
     mid =     env->GetStaticMethodID(cls, methodName, "([Ljava/lang/String;)V");
     const char * t_argv = "-m tomtom_utrecht_2008_04.db3 -i \"L;ID;0,0,15280001229524,15280001349498,-15280001349500\" -if LOCATION_STRING -of BINARY64";
     jobjectArray applicationArgs = env->NewObjectArray(1, env->FindClass("java/lang/String"), NULL);
     jstring applicationArg0 = env->NewStringUTF(t_argv);
     env->SetObjectArrayElement(applicationArgs, 0, applicationArg0);
     if (mid != NULL) env->CallStaticVoidMethod(cls, mid, applicationArgs);
     else printf("Method %s corrupted!\n", methodName);
}the command line argument is not accepted. the real string i have to deliver to the function is:
-m tomtom_utrecht_2008_04.db3 -i "L;ID;0,0,15280001229524,15280001349498,-15280001349500" -if LOCATION_STRING -of BINARY64
As you can see, a *"* is used in that string. I quoted it with the *\*
Is that wrong quoting?
Does anybody have any hints for me?
Thank you!
Cheers huck
Edited by: huckleberry on 08.09.2011 00:16
Edited by: EJP on 8/09/2011 18:35: code tags

huckleberry wrote:
JNI_IF is a kind of a handler, which triggers a method from a jar file, which I need in my C++ project. That myJAR.jar which demands the mentioned string as parameter.
With that earlier code you've mentioned in the previous post, there was the "70" as inputparameter and that worked properly.
The thing what have been changed is, I have a " in my string itself.Nope.
You have CODE which has nothing to do with java nor jni to which WE do not have access.
Let us call that code X.
X is doing something. WE don't know what. And it isn't working. Since we don't have X we can't possibly tell you what is wrong.
One thing I can tell you - you are embedding double quotes in your string. Since that presumably isn't working it is pretty certain that that by itself is not going to lead to a solution. However to verify you should print your arg string before using it - JUST before you use it. Then you can verify the form.
Other than that I can provide some guesses.
1. X is calling an external executable. X does not have a way to correctly parametrize arguments. Or it does and you are not using it. If the first then you are probably out of luck. If the second then you should figure it out.
2. X is doing some sort of pseudo argument passing mechanism. Either you do not understand how it works or the code is doing it wrong. Solution to the first is to figure out the correct way. Second best you can do is try some other way of doing it.
3. You are attempting to parametrize or escape something. The question is what. Normally the idiom (quotes) would only be needed with spaces in the parameter. Presumably you tried it without quotes. There might be a way to escape the '-' (only thing I can see that would need double quotes). You MIGHT do that with \\- (two back slashes - not one.) But there might be some other way as well.

Similar Messages

  • Finding multiple strings in a text file and deleting the entire line

    Get-Content c:\output-Copy.txt | Where-Object {$_ -notmatch 'something1', 'something2', 'something3', 'something4' } | Set-Content temp.txt
    Above is the program that when it has 1 argument in the -notmatch part will find the specific string and delete the entire line. I need to be able to use multiple strings for my search, I am totally drawing a blank on this and I know its something REALLY
    simple but my brain is fried. The above code will work IF i only leave 'something1' and delete the rest. I need to find MULTIPLE matches and remove them all at once, what is a good way to accomplish this.

    You can use an alternating regex, like this:
    Get-Content c:\output-Copy.txt |
    Where-Object {$_ -notmatch 'something1|something2|something3|something4' } |
    Set-Content temp.txt
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How can I send multiple string commands into a VISA write?

    Hi Fellow LabVIEW users
    I am very new to LabVIEW (2.5 months) so please forgive me if my lingo is not up to par.
    How can I send multiple string commands to a VISA write. For example each string command looks like this
    1) 3A00 0000 0000 FFFF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0033 (Scenario 1)
    2) 3A01 0000 0000 FFFF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0034 (Scenario 2)
    3) 3A01 0000 0000 33FF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0067 (Scenario 3).
    and so on and so forth. And there are a number of scenarios.
    Each String scenario will give a different string output which will be interpreted differently in the front panel.
    Right now I have to manually change the string commands on the front panel to give me the desired output. How can I do this without manually changing the commands i.e. hard coding each scenario into the block diagram?
    Thanks, any feedback will help.
    mhaque

    Please stick to your original post.

  • How do I input multiple string constants into VISA Write

    I am trying to put in multiple string commands into VISA Write to control a motor arm. However, when I use "concatenate strings" to link together my multiple string constants, only the first command is executed, and neglects the other commands below it. Should I be using something other then "concatenate strings" or do I need to use a delay so that the next command executes when the one before it is finished? Help.

    Concatenate strings should work or just use one string constant with multiple lines. The problem you're having could be that the instrument requires some sort of delay but without details on the instrument, only you or the vendor can answer that. Some instruments will have a queue and others won't. The other possiblity is that you need some kind of termination character between commands. This might be a carriage return for a serial instrument or the ; character for a GPIB one. Check the instrument manual or provide the make and model and maybe someone here has some experience with it.

  • Commandline arguments to open private firefox window with toolbox (web console) open.

    Hi there :)
    I would like to launch FireFox 33.1 from Visual Studio 2013 with the commandline arguments that will:
    1.) Open a private window (no cache/no history)
    2.) Will have the toolbox open with the Console tab selected (Toolbox is normally opened with F12)
    I tried launching with:
    -private-window -> this worked fine, new private window opens up
    but the console parameters do not work:
    -console -> no console
    -jsconsole -> a slimmed down popup
    -inspector -> no console
    Any assistance would be much appreciated.

    Cor-el's suggestion resolved my problem. Apparently the MOZ_NO_REMOTE variable was set to 1 on my system variables. I never made it, and really have no idea how it got there, but deleting this variable and restarting firefox has resolved the issue. Thanks Cor-el!
    Marking case: Solved
    Solution: Verify the MOZ_NO_REMOTE variable is NOT set to 1. This can be achieved by simply deleting this variable.

  • Help with deleting multiple strings from file.......

    I am trying to delete the same string that may appear multiple times in the file. Here is the output to the screen. Here is the code. I have been researching the delete method it says that I have to start at an index position in the string but how would I find out where the multiples strings reside in the file? I am getting the feeling that it won't work for my purpose..???? I am trying to delete all ot the strings "a string of data3" from the file.
    Output
    C:\TestRead>java StringDelete
    Temp String file_data-------- a string of data3a string of data2a string of data
    1a string of data3a string of data2a string of data1a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data2
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data1
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data2
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data1
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    Code:
    import java.io.*;
    public class StringDelete
    public static void main(String [] args)
    try
    FileInputStream fis = new FileInputStream("TestFile.txt");
    DataInputStream in = new DataInputStream(fis);
    StringBuffer file_data = new StringBuffer();
    while(in.available() > 0)
    String temp = in.readUTF(); // read in a string from the file
    file_data.append(temp); // append it to the buffer
    System.out.println("Temp String file_data-------- " + file_data);
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    boolean keepGoing = true;
    while(keepGoing)
    String toDelete = file_data.substring(0, "a string of data3".length());
    System.out.println("String toDelete-------- " + toDelete);
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    if(toDelete == null || toDelete.equals("") )
    keepGoing = false;
    else
    file_data.delete(0,"a string of data3".length());
    catch(IOException e)
    e.printStackTrace();

    Here is the output. I am trying to get each part to work before I go on to the next part that is why some code is commented out.
    I need help to know why string "a string of data3" is not deleted in the towrite string??
    Output:
    C:\TestRead>java NewStringDelete
    String v after remove [ ◄a string of data3 ◄a string of data2 ◄a string of data1
    ◄a string of data3 ◄a string of data2 ◄a string of data1 ◄a string of data3]
    String towrite after remove ◄a string of data3 ◄a string of data2 ◄a string of
    data1 ◄a string of data3 ◄a string of data2 ◄a string of data1 ◄a string of data
    3
    Code:
    import java.util.Vector;
    import java.io.*;
    public class NewStringDelete
         public static void main(String [] args)
              //String ls = System.getProperty("line.separator");
              //File file;
              Vector v=new Vector();
         try{
              BufferedReader br=new BufferedReader(new FileReader ("TestFile.txt"));
              String s;
              while ((s=br.readLine())!=null)
                   {v.addElement(new String(""+s));}
                        br.close();
         catch(IOException e)
                   e.printStackTrace();
    /*now you have a Vector containing String objects..*/
         String remove = ("a string of data3");
         String towrite="";
    System.out.println("String v after remove " + v);     
         for (int i=0; i<v.size();i++)
              String ss = (String)v.elementAt(i);
              if (ss.equalsIgnoreCase(remove)){continue;}
              //     towrite=towrite+ss+ls;
                   towrite=towrite+ss;
    System.out.println("");               
    System.out.println("");               
    System.out.println("String towrite after remove " + towrite);                    
    /*do filewrite*/
    //try{
    // FileWriter fw=new FileWriter(TestFile.txt);
    // fw.write(towrite);
    // fw.close();
    // catch(IOException e)
    //               e.printStackTrace();

  • Split a multiline string from TextEdit into multiple strings

    Hi all,
    I have a small question. I have a string that comes from a multiline TextEdit used for comments. This string has to be split into multiple strings with max 72 chars. The wrapping is set to "hard".
    Can anybody help me on this?
    Thanks
    Francisco

    Hi Francisco,
    this is the complete code I tested, a bit ugly concerning the println etc... (****, not formatting here?):
    package com.btexx;
    import java.util.StringTokenizer;
    import com.sapportals.htmlb.Button;
    import com.sapportals.htmlb.Form;
    import com.sapportals.htmlb.TextEdit;
    import com.sapportals.htmlb.enum.TextWrapping;
    import com.sapportals.htmlb.event.Event;
    import com.sapportals.htmlb.rendering.IPageContext;
    import com.sapportals.htmlb.rendering.PageContextFactory;
    import com.sapportals.portal.prt.component.AbstractPortalComponent;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    public class TextEditExample extends AbstractPortalComponent
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
            IPageContext pageCtx = PageContextFactory.createPageContext(request, response);
            Event lastEvent = pageCtx.getCurrentEvent();
            if (lastEvent == null) {
                Form form = pageCtx.createFormDocument("myFormDocument");
                TextEdit te = new TextEdit("Edit_Text");
                te.setId("TextEditID");
                te.setText("Text to change - or just add text");
                te.setWrapping(TextWrapping.HARD);
                te.setTooltip("Edit and/or add text");
                te.setRows(10);
                te.setCols(72);
                form.addComponent(te);
                Button btn = new Button("MyButton");
                btn.setOnClick("react");
                form.addComponent(btn);
                pageCtx.render();
            } else {
                TextEdit te = (TextEdit) pageCtx.getComponentForId("TextEditID");
                String text = te.getText();
    //            for (int j = 0; j < text.length(); j++) {
    //                System.out.println(text.getBytes()[j] + " - " + text.substring(j, j+1));
                StringTokenizer st = new StringTokenizer(text, "nr");
                String[] texts = new String[st.countTokens()];
                while (st.hasMoreTokens()) {
                    System.out.println("Line : " + st.nextToken());
    I swear, I did not press Return within the TextEdit box, and after that, 13/10 appeared within the text. If just this code does not work the same on your machine, then it seems to be a bug in (your) htmlb (because my P/HF are the most actual, at least they have been yesterday).
    Hope it helps
    Detlev
    Message was edited by: Mark Finnern
    added the [code ] [/code ] (without the blanks)

  • Match pattern for multiple strings in labVIEW

    I want to include multiple strings for matching in the regular expression for pattern matching.I tried using the or option and (|)
    eg:cat|dog|mouse
    If the string contains any of these it should show a match.
    Is it possible in labview or do i need to use multiple patch mattern functions to achieve this?

    Match Regular Expression function will do.
    You can search for multiple strings using | operator. This function will return the match of any one of the specified strings seperated by | operator

  • How to improve the speed of creating multiple strings from a char[]?

    Hi,
    I have a char[] and I want to create multiple Strings from the contents of this char[] at various offsets and of various lengths, without having to reallocate memory (my char[] is several tens of megabytes large). And the following function (from java/lang/String.java) would be perfect apart from the fact that it was designed so that only package-private classes may benefit from the speed improvements it offers:
        // Package private constructor which shares value array for speed.
        String(int offset, int count, char value[]) {
         this.value = value;
         this.offset = offset;
         this.count = count;
        }My first thought was to override the String class. But java.lang.String is final, so no good there. Plus it was a really bad idea to start with.
    My second thought was to make a java.lang.FastString which would then be package private, and could access the string's constructor, create a new string and then return it (thought I was real clever here) but no, apparently you cannot create a class within the package java.lang. Some sort of security issue.
    I am just wondering first if there is an easy way of forcing the compiler to obey me, or forcing it to allow me to access a package private constructer from outside the package. Either that, or some sort of security overrider, somehow.

    My laptop can create and garbage collect 10,000,000 Strings per second from char[] "hello world". That creates about 200 MB of strings per second (char = 2B). Test program below.
    A char[] "tens of megabytes large" shouldn't take too large a fraction of a second to convert to a bunch of Strings. Except, say, if the computer is memory-starved and swapping to disk. What kind of times do you get? Is it at all possible that there is something else slowing things down?
    using (literally) millions of charAt()'s would be
    suicide (code-wise) for me and my program."java -server" gives me 600,000,000 charAt()'s per second (actually more, but I put in some addition to prevent Hotspot from optimizing everything away). Test program below. A million calls would be 1.7 milliseconds. Using char[n] instead of charAt(n) is faster by a factor of less than 2. Are you sure millions of charAt()'s is a huge problem?
    public class t1
        public static void main(String args[])
         char hello[] = "hello world".toCharArray();
         for (int n = 0; n < 10; n++) {
             long start = System.currentTimeMillis();
             for (int m = 0; m < 1000 * 1000; m++) {
              String s1 = new String(hello);
              String s2 = new String(hello);
              String s3 = new String(hello);
              String s4 = new String(hello);
              String s5 = new String(hello);
             long end = System.currentTimeMillis();
             System.out.println("time " + (end - start) + " ms");
    public class t2
        static int global;
        public static void main(String args[])
         String hello = "hello world";
         for (int n = 0; n < 10; n++) {
             long start = System.currentTimeMillis();
             for (int m = 0; m < 10 * 1000 * 1000; m++) {
              global +=
                  hello.charAt(0) + hello.charAt(1) + hello.charAt(2) +
                  hello.charAt(3) + hello.charAt(4) + hello.charAt(5) +
                  hello.charAt(6) + hello.charAt(7) + hello.charAt(8) +
                  hello.charAt(9);
              global +=
                  hello.charAt(0) + hello.charAt(1) + hello.charAt(2) +
                  hello.charAt(3) + hello.charAt(4) + hello.charAt(5) +
                  hello.charAt(6) + hello.charAt(7) + hello.charAt(8) +
                  hello.charAt(9);
             long end = System.currentTimeMillis();
             System.out.println("time " + (end - start) + " ms");
    }

  • Does the Firmware Password Application support commandline arguments

    Can anyone tell me does the firmware password application support commandline arguments. What are they ?
    Thanks...

    Hello! You might find THIS article on open firmware helpful. Tom

  • [SOLVED] ncmpcpp 0.6.x depreciated commandline arguments

    Hmmm, I used to have external keyboard shortcuts and mouse bindings to pause/switch tracks at will.  Now it is gone in 0.6.x beta and I don't have 0.5.x anymore since I last cleared the pkg cache recently..   Time to visit ARM and downgrade.
    Last edited by ssri (2014-09-27 00:18:13)

    Rasi wrote:
    ssri wrote:or not running at all.
    Then I dont see the issue AT ALL. just use mpc. its also not running at all
    Also convenient for you to ignore the rest of my statement .  Oh well.  I'm just stating that it was more convenient to use ncmpcpp for my use case and I'm quite content to keep ncmpcpp pinned at 0.5.10.  As for my OP, I didn't notice any news from the project's page that some of ncmpcpp's commandline arguments were depreciated and reported it here.  The subsequent reply post rightfully pointed out that mpc offered the same commandline options.  For me, there are two options, keep ncmpcpp pinned or move over to mpc.  I decided to go with the former.  That is all I'm going to say.
    EDIT: Since I tend to control mpd in the background (outside of ncmpcpp or mpc) while working in a DE, I changed all of my keyboard shortcuts and mouse gestures to 'mpc foo'  Just laziness on my part *shrugs*
    Last edited by ssri (2014-09-27 00:18:37)

  • [svn] 2785: update clover code coverage report, add tests for asc commandline arguments

    Revision: 2785
    Author: [email protected]
    Date: 2008-08-08 09:56:23 -0700 (Fri, 08 Aug 2008)
    Log Message:
    update clover code coverage report, add tests for asc commandline arguments
    Modified Paths:
    flex/sdk/trunk/modules/asc/build/java/build.xml
    flex/sdk/trunk/modules/asc/test/compiler/runtests.py
    flex/sdk/trunk/modules/asc/test/compiler/testconfig.txt
    Added Paths:
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/abcfuture.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/avmtarget.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/avmtarget.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/avmtargetn.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/avmtargetn.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/config.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/config.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/exe.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/exe.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/help1.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/help1.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/help2.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/help2.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/m.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/metadata.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/movieclip.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/sanity.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/sanity.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/show_bytes.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/show_flow.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/show_flow.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/show_instructions.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/show_parse_trees.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/show_parse_trees.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/static_semantics.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/static_semantics.err
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/swf.as
    flex/sdk/trunk/modules/asc/test/compiler/cmdline/swf.err

  • Trapcode, particular, multiple string(streamer) effects

    heya,
    i had posted a message late last year asking for help about creating a string type effect
    see: http://www.adobeforums.com/webx/.59b7519f/5?14@@
    (which graciously Aaron Cobb helped me out with!).....I wanted to create a multiple string image,
    is there a way of doing, so multiple strands flow like hair in the wind, without having to make up lots of light emitters?
    cheers
    nathan

    Well, in Particular you can get the strings to point outwards, but you won't be able to get them to behave as if wind was rushing out from the center. To get the strings to point outwards, use the "Outwards" option for the direction (this doesn't work for light emitters, FYI). Trouble is, when you do this, you will have to rely on particle velocity and not wind to extend the strings, meaning the turbulence field won't follow the motion. You can increase the turbulence field's evolution speed, but it will just make the strings jiggle, not flap as if in a breeze.
    Form very likely has similar options, but I don't have any experience with it, so you'll have to do some exploration.

  • Script to search all files in specified folder for multiple string text values listed in a source file and output each match to one single results txt file

    I have been searching high and low for this one.  I have a vbscript that can successfully perform the function if one file is listed.  It does a Wscript.echo on the results and if I run this via command using cscript, I can output to a text file
    that way.  However, I cannot seem to get it to work properly if I want it to search ALL the files in the folder.  At one point, I was able to have it create the output file and appear as if it worked, but it never showed any results when the script
    was executed and folder was scanned.  So I am going back to the drawing board and starting from the beginning.
    I also have a txt file that contains the list of string text entries I would like it to search for.  Just for testing, I placed 4 lines of sample text and one single matching text in various target files and nothing comes back.  The current script
    I use for each file has been executed with a few hundred string text lines I want it to search against to well over one thousand.  It might take awhile, but it works every time. The purpose is to let this run against various log files in a folder and
    let it search.  There is no deleting, moving, changing of either the target folder/files to run against, nor of the file that contains the strings to search for.  It is a search (read) only function, going thru the entire contents of the folder and
    when done, performs the loop function and onto the next file to repeat the process until all files are searched.  When completed, instead of running a cscript to execute the script and outputting the results to text, I am trying to create that as part
    of the overall script.  Saving yet another step for me to do.
    My current script is set to append to the same results file and will echo [name of file I am searching]:  No errors found.  Otherwise, the
    output shows the filename and the string text that matched.  Because the results append to it, I can only run the script against each file separately or create individual output names.  I would rather not do that if I could include it all in one.
     This would also free me from babysitting it and running each file script separately upon the other's completion.  I can continue with my job and come back later and view the completed report all in one.  So
    if I could perform this on an entire folder, then I would want the entries to include the filename, the line number that the match occurred on in that file and the string text that was matched (each occurrence).  I don't want the entire line to be listed
    where the error was, just the match itself.
    Example:  (In the event this doesn't display correctly below, each match, it's corresponding filename and line number all go together on the same line.  It somehow posted the example jumbled when I listed it) 
    File1.txt Line 54 
    Job terminated unexpectedly
     File1.txt Line 58 Process not completed
    File1.txt
    Line 101 User input not provided
    File1.txt
    Line 105  Process not completed
    File2.txt
    No errors found
    File3.txt
    Line 35 No tape media found
    File3.txt
    Line 156 Bad surface media
    File3.txt Line 188
    Process terminated
    Those are just random fake examples for this post.
    This allows me to perform analysis on a set of files for various projects I am doing.  Later on, when the entire search is completed, I can go back to the results file and look and see what files had items I wish to follow up on.  Therefore, the
    line number that each match was found on will allow me to see the big picture of what was going on when the entry was logged.
    I actually import the results file into a spreadsheet, where further information is stored regarding each individual text string I am using.  Very useful.
    If you know how I can successfully achieve this in one script, please share.  I have seen plenty of posts out there where people have requested all different aspects of it, but I have yet to see it all put together in one and work successfully.
    Thanks for helping.

    I'm sorry.  I was so consumed in locating the issue that I completely overlooked posting what exactly I was needing  help with.   I did have one created, but I came across one that seemed more organized than what I originally created.  Later
    on I would learn that I had an error in log location on my original script and therefore thought it wasn't working properly.  Now that I am thinking that I am pretty close to achieving what I want with this one, I am just going to stick with it.
    However, I could still use help on it.  I am not sure what I did not set correctly or perhaps overlooking as a typing error that my very last line of this throws an "Expected Statement" error.  If I end with End, then it still gives same
    results.
    So to give credit where I located this:
    http://vbscriptwmi.uw.hu/ch12lev1sec7.html
    I then adjusted it for what I was doing.
    What this does does is it searches thru log files in a directory you specify when prompted.  It looks for words that are contained in another file; objFile2, and outputs the results of all matching words in each of those log files to another file:  errors.log
    Once all files are scanned to the end, the objects are closed and then a message is echoed letting you know (whether there errors found or not), so you know the script has been completed.
    What I had hoped to achieve was an output to the errors.log (when matches were found) the file name, the line number that match was located on in that file and what was the actual string text (not the whole line) that matched.  That way, I can go directly
    to each instance for particular events if further analysis is needed later on.
    So I could use help on what statement should I be closing this with.  What event, events or error did I overlook that I keep getting prompted for that.  Any help would be appreciated.
    Option Explicit
    'Prompt user for the log file they want to search
    Dim varLogPath
    varLogPath = InputBox("Enter the complete path of the logs folder.")
    'Create filesystem object
    Dim oFSO
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
    'Creates the output file that will contain errors found during search
    Dim oTSOut
    Set oTSOut = oFSO.CreateTextFile("c:\Scripts\errors.log")
    'Loop through each file in the folder
    Dim oFile, varFoundNone
    VarFoundNone = True
    For Each oFile In oFSO.GetFolder(varLogPath).Files
        'Verifies files scanned are log files
        If LCase(Right(oFile.Name,3)) = "log" Then
            'Open the log file
            Dim oTS
            oTS = oFSO.OpenTextFile(oFile.Path)
            'Sets the file log that contains error list to look for
            Dim oFile2
            Set oFile2 = oFSO.OpenTextFile("c:\Scripts\livescan\lserrors.txt", ForReading)
            'Begin reading each line of the textstream
            Dim varLine
            Do Until oTS.AtEndOfStream
                varLine = oTS.ReadLine
                Set objRegEx = CreateObject("VBScript.RegExp")
                objRegEx.Global = True  
                Dim colMatches, strName, strText
                Do Until oErrors.AtEndOfStream
                    strName = oFile2.ReadLine
                    objRegEx.Pattern = ".{0,}" & strName & ".{0,}\n"
                    Set colMatches = objRegEx.Execute(varLine)  
                    If colMatches.Count > 0 Then
                        For Each strMatch in colMatches 
                            strText = strText & strMatch.Value
                            WScript.Echo "Errors found."
                            oTSOut.WriteLine oFile.Name, varLine.Line, varLine
                            VarFoundNone = False
                        Next
                    End If
                Loop
                oTS.Close
                oFile2.Close
                oTSOut.Close
                Exit Do
                If VarFoundNone = True Then
                    WScript.Echo "No errors found."
                Else
                    WScript.Echo "Errors found.  Check logfile for more info."
                End If
        End if

  • Returning String data through argument

    I need to write a method to call the following method:
    int myFunc(char *buf, int code);
    Where I need the return value integer and I also want to get back the char * as a string.
    I am thinking the most straightforward thing to do would be:
    public native int myFunc(StringBuffer sb, int code);
    and then in my native code create the return string and use the MethodID functions to call the StringBuffers append() method.
    I considered making two functions - one to get the string and one to check for an error, but figured that could cause threading implications in the future.
    I assume this is a common issue, is there a recommended solution?
    Thanks,
    mike

    Sorry I didn't reply earlier- never really came back to this thread - the solution I suggested in my first message worked great for me.
    Here's what it looks like (the relevant bits at least):
    * Class: com_nmss_ms_log_hsLogger
    * Method: lgGetText
    * Signature: (Ljava/lang/StringBuffer;Ljava/lang/String;I)I
    JNIEXPORT jint JNICALL Java_com_nmss_ms_log_hsLogger_lgGetText
    (JNIEnv *env, jobject obj, jobject stringBuf, jstring id, jint msgId, jchar ss_id)
    char buff[501];
    int result, i;
    jstring retString;
    jclass cls = (*env)->GetObjectClass(env, stringBuf);
    jmethodID mid = (*env)->GetMethodID(env, cls, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
    result = logGetText(log_handle, msgId, buff, 500);
    retString = (*env)->NewStringUTF(env, buff);
    (*env)->CallObjectMethod(env, stringBuf, mid, retString);
    return result;
    }

Maybe you are looking for