Reading Hex data- how to typecast from string

Hi,
I am reading a file having hex data ( say 100 lines).When i read it i think it is being read as a string.
How can i typecast or convert it to int .
I am using dis.readLine() to read from file and assigning it to a variable(int).
Thanks.
Edited by: Motorcycle on Jun 10, 2009 3:16 PM

Sorry for that..:)
ok a few lines of the file are as folloes
0x004D1202
0x0002E1E5
0x004C1202
0x0002E1EB
0x004E1202
I tried reading it as data [indr][indc].tag = ( int ) dis.readLine() ;
It said " cannot convert from String to int.
data is a structure having int variables.
Thanks.

Similar Messages

  • Need to read Hex data format for Handheld device. (SAP AII RFID )

    Hello,
    we developed a custom screens for packing, unpacking, tag commission.. etc for handheld device for my client. the Serial number field  type is /ain/barcode. Its working fine. but for the new system need to read the Hex format. I created a new field in the screen. but the handheld device is not reading the Serial number in Hex format.
    Could anyone suggest me how to read Hex data in Handheld devices. We are using Motorola MC9090 Series.
    Regards,
    Kamal

    Hi
    Are you using the reader to read an RFID tag or for reading barcodes.
    Ideally, if you read an EPC Gen2 RFID tag, for example, the 96 bit encoded EPC is read and that can be converted to its equivalent  HEX format for posting the observation to SAP AII.
    In case of barcodes, the string is read as is printed on the barcode.

  • Question about reading hex data

    Hello! I am a Labview Novice and having a problem about reading hex data.
    Basically I am having bytes from the serial port like this: "80100E0E0AB4F646F24A00911267087E032080057FFF "
    It is not encoded in ASCII. What I want to do is to convert the hex to an ASCII hex string.
    so that the string would become hex numbers in ASCII.
    I think the following might be a solution, but I have no idea what the subvi is in the solution.
    http://forums.ni.com/t5/LabVIEW/Hex-String-to-Ascii-Hex-String/m-p/886078/highlight/true#M400462
    Thanks in advance and I appreciate your kind help!
    Solved!
    Go to Solution.

    coolmatthew wrote:
    What I want to do is actually this.
    You are using way too much code for all this. All you need is a concatenate strings, replacing your entire loop and such. Same result.
    (see also)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    HEXTwiddler.png ‏4 KB

  • How does "Unflatten From String" take a type and return a value of that type?

    http://zone.ni.com/reference/en-XX/help/371361E-01/glang/unflatten_from_string/
    How exactly does the "type" argument for "Unflatten From String" work? I need to create a VI that takes a type, passes it as an argument to several calls of the "Unflatten From String" function, and returns an array containing elements of the type originally passed. The "Unflatten From String" function seems to do some magic though, because the type of the "value" that it outputs changes depending on the type it is passed as input. How do I do the same magic in my VI?
    Ultimately, what I need to accomplish is an unflatten-list operation. Given a type T and a byte string of length L (which contains a concatenation of T elements that are flattened to their bytes), create a VI that unflattens all the types in the string and return an array of length (L / sizeof(T)) that contains each type.
    Note: performing the unflatten-list operation is trivial, but I cannot for the life of me figure out how to do it in a VI that takes a type and returns an array of the appropriate type. By the way, my data is being given to me from another source, so please don't bother suggesting that I should be flattening an array using LabVIEW's "Flatten To String" function in the first place. My data is not given in LabVIEW's array format: http://zone.ni.com/reference/en-XX/help/371361B-01/lvconcepts/flattened_data/
    Thanks a ton!
    -Wakka

    Take a look at this example:  You can see that the flattened string contains several bytes.  The first four bytes contain the length of array (number of elements).  Since the data type is U32, the next 32 bits (4 bytes) contains the value of the first element, and so on.  Could you possibly use this scheme to do what you want to do?  Other data types present different outputs.  You would have to experiment with them.
    - tbob
    Inventor of the WORM Global

  • How to typecast a String [] to a List ??

    Hi all,
    I wanted to typecast a String [] to a List.
    The only way I could think of was to run a loop thru the array and add the elements one by one to the List.
    Just wondering if there is a smarter way to do it!!
    Thanks

    Ronakgpatel wrote:
    Hi,
    Just refer java.util.Arrays class
    List lst = Arrays.asList(arr);
    Didn't I already say that? Except the spoonfeeding.
    db

  • How to protect read-only data in Swing app from tampering?

    First off I am new to cryptography and trying to find the best approach for a problem.
    We have a Swing application that uses xml-based template files to display complex forms and validate data entry. Based on the size and complexity of the forms it was deemed better to have a distributed stand-alone application instead of a web-based solution. However, we want to ensure users do not tamper with the template rules in order to pass the validation checks. All of the xml-based template files are distributed within a single jar file.
    The first thought was to build a list of check-sums of the template files and to compare the template to the approariate check-sum from within the list before loading a template. This would prevent the more casual user from tampering with the file but not someone knowledgeable in check-sum who could recalculate the CRC and update the list after making changes.
    Another thought was to use a private key to encrypt the CRC list before distribution and a public key to decrypt it during execution with the keys maintained in a keystore. However, once again, an adventurous user could weed through the obfuscated code to determine the password to the keystore, create a new keystore with the same password and use its private key to regenerate the CRC list from altered templates.
    I feel like there must be a simpler approach that will provide a bullet prove implementation. Any suggestions?

    I think you have to re-think your design.
    Whether you use Java, C#,C or C++ a hacker can look through the binary (class file, exe file etc) and after working out what is happening he can modify your code.
    It is my opinion that your best bet is to use client/server but even with that you cannot keep any private data or code on the client.
    You will still have to think about 'man-in-the-middle' and 'spoof site' attacks.

  • How can I read/write data files (text file) from PL/SQL Script

    I had an oracle forms pl/sql program to read/write a data file (text file). When this code is run on a command line as a PL/SQL script using the SQL*Plus I am getting an error:
    -- sample.sql
    DECLARE
      vLocation                 VARCHAR2(50)  := 'r:\';
      vFilename                 VARCHAR2(100) := 'sample.dat';
      vTio                   TEXT_IO.FILE_TYPE;
      vLinebuf               VARCHAR2(2000);
      vRownum               NUMBER        := 0;
      -- use array to store data FROM each line of the text file     
      TYPE           array_type IS VARRAY(15) OF VARCHAR2(100);
      vColumn      array_type := array_type('');
      PROCEDURE prc_open_file(p_filename IN VARCHAR, p_access IN VARCHAR2) is
      BEGIN
        vTio := TEXT_IO.FOPEN(vLocation||p_filename,p_access);
      EXCEPTION
        WHEN OTHERS then
          --  raise_application_error(-20000,'Unable to open '||p_filename);
          message(sqlerrm);pause;
      END;
      PROCEDURE prc_close_file is
      BEGIN
        IF TEXT_IO.IS_OPEN(vTio) then
           TEXT_IO.FCLOSE(vTio);
        END IF;
      END;
    BEGIN
      --extend AND initialize the array to 4 columns
      vColumn.EXTEND(4,1);
      prc_open_file(vFilename,'r');
      LOOP
          LTEXT_IO.GET_LINE(vTio,vLinebuf);
          vColumn(1)  := SUBSTR(vLineBuf, 1, 3);
          vColumn(2)  := SUBSTR(vLineBuf, 5, 8);
          vColumn(3)  := SUBSTR(vLineBuf,10,14);     
          Insert Into MySampleTable
          Values
            (vColumn(1), vColumn(2), vColumn(3));
          EXIT WHEN vLinebuf IS NULL;
       END LOOP;
       prc_close_file;
    END;
    SQL> @c:\myworkspace\sql\scripts\sample.sql;
    PLS-00201: identifier 'TEXT_IO.FILE_TYPE' must be declaredIt works on the oracle forms but not on the SQL*Plus. Is there an alternative method using a PL/SQL script? A simple sample would help. Thanks.

    Did you ever noticed the search box at the right side of the forum?
    A quick search (limited to this years entries) brought up this thread for example
    Re: UTL_FILE Examples

  • Sending/reading hex data to a serial port in Powershell

    I have a device which responds to serial port requests. Using portmon I can see a request formatted as a six byte hex string.
    e.g. x'02031005E6 the last byte being a crc which I can work out.
    I don't seem to be able to write this data to a comm port as if I write
    [Byte[]] $request = 0x02,0x03,0x10,0x05,0xE6
    $port.Write($request)
    I see
    0.00189600 powershell_ise IRP_MJ_WRITE LSerial0 SUCCESS Length 12: 32 20 33 20 31 36 20 35 20 32 33 30  
    where I was expecting Length 6: 02 03 10 05 E6
    even if I write
    [Byte] $request = 0x02
    $port.Write($request)
    I get
    0.00188317 powershell_ise IRP_MJ_WRITE LSerial0 SUCCESS Length 1: 32  
    I have a nasty feeling I am misunderstanding how Powershell handles hex strings/arrays and will assume the sucking of air through clenched teeth on the reply.

    Your handling of Bytes, hexadecimal literals and arrays is fine. What type of object is the $port variable referring to?
    Edit:  If it's a [System.IO.Ports.SerialPort] object, then the problem is that you're calling SerialPort.Write() with a single argument.  The only overload of that method which takes a single argument accepts a String parameter, and PowerShell
    is automatically turning your bytes / arrays into a string representation (which is then being converted back into a byte stream.)
    To use SerialPort.Write with a Byte[] argument, you need to pass in 3 arguments:  The array, the offset, and the byte count.  For example:
    [Byte[]] $request = 0x02,0x03,0x10,0x05,0xE6
    $port.Write($request, 0, $request.Count)
    See
    http://msdn.microsoft.com/en-us/library/System.IO.Ports.SerialPort.Write(v=vs.110).aspx for more info.

  • IPhoto reads wrong date of .mov file from iPhone 3GS...help!

    Hi all
    Need some help/advice please.
    I have a bunch of files I am importing in to iPhoto that were initially downloaded to a windows laptop. I used Graphic Converter (GC) to successfully rotate and align the creation/modified dates so iPhoto reads the correct date. Now GC edits the .jpg and .avi file metadata fine, but wont edit .mov files from my iPhone? So now the iPhone videos are strewn all over the place in iPhoto compared to where they should be date-wise. Any ideas on how to fix this issue?
    The .mov files in GC show the correct creation date, but iPhoto reads the actuals file's modified date instead of the internal creation date? So strange?
    Thanks
    Jared

    iPhoto gets it's date and time from the Photos Exif metadata, not the file creation or modification dates. It will only use those if your photos have no Exif.
    If you subsequently export these files then the created and modification dates a re very likely to change.
    You can adjust the date and time rather more easily in iPhoto (Using either the Photos -> Adjust Date and Time and/or the Photos -> Batch Change commands) You can also write the corrected date and time to the Exif of the oriignals files, and export it along with the file in the future.
    I'm not sure what's up with the dates on these mov files, but Movies don't have an Exif. You might want to check with the makers of Graphic Coverter for help.
    You know that you can move pics and movies around inside iPhoto, right? Drag them from Event to Event?
    Regards
    TD

  • Read XML data without name spaces from PL/SQL

    Hi,
    I am trying to upload XML data without namespaces into Oracle tables from PL/SQL. Below is the sample XML data.
    Please let me know,How this is achievable in PL/SQL?
    <?xml version="1.0" ?>
    <insplist ver="2" count="1">
    <insp id="219991" timestamp="134817078" stat="G" operator_id="999999" >
    <data name="TIME CLOCK - PUNCH" val="INNER" type="STRING" />
    </insp>
    </insplist>
    Thanks

    And it's even simpler with the GET method as we just have to pass the url :
    SQL> DECLARE
      2 
      3    v_url      varchar2(200) := 'http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=';
      4    v_address  varchar2(200) := '1 rue Victor Hugo Paris France';
      5 
      6    v_req      utl_http.req;
      7    v_rsp      utl_http.resp;
      8 
      9 
    10 
    11    v_xml      varchar2(32767);
    12 
    13    v_lng      number;
    14    v_lat      number;
    15 
    16  BEGIN
    17 
    18    v_req := utl_http.begin_request(v_url || utl_url.escape(v_address), 'GET', utl_http.HTTP_VERSION_1_1);
    19    v_rsp := utl_http.get_response(v_req);
    20 
    21    utl_http.read_text(v_rsp, v_xml);
    22    utl_http.end_response(v_rsp);
    23 
    24    select longitude, latitude
    25    into v_lng, v_lat
    26    from xmltable(
    27         '/GeocodeResponse/result/geometry/location'
    28         passing xmlparse(document v_xml)
    29         columns longitude number path 'lng'
    30               , latitude  number path 'lat'
    31         )
    32    ;
    33 
    34    dbms_output.put_line('Longitude = ' || v_lng);
    35    dbms_output.put_line('Latitude = ' || v_lat);
    36 
    37  END;
    38  /
    Longitude = 2.2734472
    Latitude = 48.8282741
    PL/SQL procedure successfully completed
    Or, taking shorcuts :
    SQL> select *
      2  from xmltable(
      3       '/GeocodeResponse/result/geometry/location'
      4       passing httpuritype('http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address='
      5                           || utl_url.escape('1 rue Victor Hugo Paris France')
      6                           ).getxml()
      7       columns longitude number path 'lng'
      8             , latitude  number path 'lat'
      9       )
    10  ;
    LONGITUDE   LATITUDE
    2,2734472 48,8282741

  • VISA error when trying to read hex data over serial port

    Hi - Sorry about this. I am posting this question as a new thread as I am still having serious problems and may be able to shed more light now.
    Basically I am trying to read data formatted as a string of comma separated hexadecimal words over the serial link.
    The data is formatted thus:  <first word>,  <second word>, <third word> etc.... <last word, <CR>  where <CR> is a carriage return.
    Where each word represents a number, e.g.  AB01 is 43777 in decimal.
    Now the VI is stalling at VISA close (I attach VI again to this message), the string data is read across by the VI but it will not then close the link unless I remove to USB cable from the comms port.  When I run the device in hyperterminal I do not have this problem.  The data sting comes back fine (when I send out the command message), the carriage return is recognized as the end of the data message and the comma channel is cleared and ready to accept the next command message.
    LabVIEW is then not happy.  I don't know why but it could be that the amount of data the demo device I have is sending back is more than the NI-VISA can cope with.  Am I correct in thinking 13kbytes is the maximum.  If this were the case This would account for my problem.  It seems that the number of bytes read by the VI is consistently 12999.
    Hope someone can help or this information will at least be useful to somebody so they don't have this problem.
    Many Thanks
    Ashley.

    Yes there is. If your data contains data from 0x00 to 0xFF then you have to disable the 'termination char' in the VISA configure function. The boolean input at the top. Set it to false. Otherwise your transmission will stop at 0x0A by default. You can also tell what the termination character should be, if you want.
    btw. Still no VI attached. 
    Sorry replied to the wrong message. No I did not where are both replying at the same time
    Message Edited by K C on 12-08-2005 12:44 PM
    Message Edited by K C on 12-08-2005 12:46 PM

  • How to extract from string

    I know I have done this in CVI before..
    I just can't remember how I did it.. 
    (braindead today???!!!???)
    Here goes:
    Take a string:
    "Mary had a little lamb"
    FindPattern "little"
    resulting string:  ""Mary had a lamb"
    What I have works up to finding the pattern and it's location.
    -sigh-
    I know I'll kick myself because from what I recall, it's a very simple solution... I just can't think of it..
    And I vaguely remember the function name that I used...
    R
    Solved!
    Go to Solution.

    Thanks,
    I should have mentionned that the token in this case is a backspace '\b' character.
    The idea is to remove all backspace characters and the character preceding it.
    R
    Here's a sample of the data:
    [Counting] erozurozefozerczeroberozurozefozerczerobNumber of test Errors: 0

  • Read table data and fetch file from path specified in table column

    Hi,
    I have a situation where file path information is stored in database table along with other columns - I need to read data from SQL Server table row by row, go to the path identified by the record, check for existance of the file - if the file is available copy it to a staging area, then read the next record. Repeat this process until the last record is fetched from the table. At the end, zip all the files found and FTP to a different location. If the file is not found in the path specified, write the database record to a seperate text file.
    At end of the process, send an email with records for which files were not found at specified location.
    Thanks
    Edited by: user4566019 on Oct 5, 2008 4:32 AM

    Hi,
    That is not complex to solve at ODI.
    Try the following.
    1) Create a package
    2) create a variable to receive the path as parameter and drag and drop it at package as "Declared"
    3) drag and drop the ODI Tool "odiFileMove" using and let the variable as patch at ODI Tool parameter.
    Use the parameters -ACTION=MOVE -TIMEOUT=100 and -NOFILE_ERROR=NO (take a look at ODI Toos Reference for other parameters)
    3) Create a "KO" (error) flow to write the variable at a text file. That will allow the process knows what file is missing
    4) generate a scenario of this package
    5) create a procedure
    6) at first step, put the query from SQL Server (set the Logical Schema to the right connection)
    7) at Target tab, put the call to the scenario generated using the returned value from query parameter. Plus, let the -SYNC_MODE=1. That will call one scenario by time.
    8) create a new step to zip the files at stage directory
    9) create a step to make the ftp
    10) create a step to mail the txt generated with files not founded. If you wish, you can make a validation on the file to see if is necessary to send the mail, it means, if there is any file missing.
    Does it help you?

  • Convert from String data type to Character data type

    Hi...,
    I'm a beginner. I try to make a program. But I don't know how to convert from string to data type. I try to make a calculator with GUI window. And when somebody put "+" to one of the window, I just want to convert it to Character instead of String.
    Sorry of my bad english..
    Please help me....
    Thanks

    String s = "a+b";
    char theplus = s.charAt(1);

  • How to get substring from string starting from the end of string

    Hi
    How to cut from string:
    $A=C:\ClusterStorage\Volume1\WXP-plwropc300\Virtual Hard Disks\WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    this substring (name of VHD file): WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    This script should be universal so the best way to be cut all leters from the end of string $A till get the first mark \
    Thank you for help.
    Tomasz
    Kind Regards Tomasz

    PS > Split-Path 'C:\ClusterStorage\Volume1\WXP-plwropc300\Virtual Hard Disks\WXP-PLWROPC300_EE20E00F-315E-4781
    -A6DE-68497D4189B8.avhdx' -leaf
    WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    PS >
    That is what "Split-Path" is for:
    ¯\_(ツ)_/¯

Maybe you are looking for

  • IBAN update for vendor bank details using  rfbikr00

    Hello, I am trying to update the IBAN details of vendor using standard upload program rfbikr00.While doing the same, the IBAN is not updated to the corresponding bank details line, rather it is creating a new line with IBAN only. I am using the below

  • FB05 clearing item

    Hi, is it possible with FB05 to run clearing for a single line item of a FI document or do I have to run clearing for the all document? If it possible to run clearing for a single line item, how can I do it? Regards and thank you for your time Norber

  • USB Mic cutting out

    Well, here's my problem. I play WoW (World of Warcraft) and my guild uses ventrilo (speex codec and it works fine). I use a plantronics usb headset which is great, but every once in a while my computer will lock up (sometimes just for 5 seconds, some

  • What are the steps in formatting my iphone

    what are the steps in formatting my iphone

  • OneStep DVD lost of sound half way through the tape

    When transferring one of my mini dv's I completely lose all sound half way through the tape. This lost of sound also corresponds to a new scene in the tape. From then on all sound is lost. The following tape is done in the exact settings (surrounding