String to IntPtr conversion

Hi Guys,
how can we convert string into IntPtr.  I am using C# and .net cf v 1.0 for development.
Thnx

Hi,
It's not a straight forward process, essentially you need to allocate some unmanaged memory and then "copy" the string across into the unmanaged buffer you have allocated (also taking care of freeing the memory afterwards..).
The article "Advanced P/Invoke on the Microsoft .NET Compact Framework" available at http://msdn2.microsoft.com/en-us/library/aa446529.aspx has a number of alternative approachs you can use to implement this in code. In particular have a look at the section titled "Using a Managed String Pointer".
I would recommend reading the entire article, as just reading the suggested section probably won't make a lot of sense until you've read other parts of the article.
Hope this helps,
Christopher Fairbairn.
PS: If you were using CF2.0 then you may be able to use the Marshal.StringToBSTR method found within the System.Runtime.InteropServices namespace depending upon your exact requirements.

Similar Messages

  • Missing charsets in STring to FontSet conversion

    Hi,
    After installed SUn OS 10, I am trying to install SMC and I got a warning error: Missing Charsets in String to FontSet conversion. Cannot convert string "-monotype_arrial-regular-r-normal --*-140-*-*-p-*-iso8859-2" to type FonsStruct
    and so on, with different font types. etc....
    How can I find out which fontset in the Unix box? How can I permanent set it back to UTF-8 w/o re install OS again?
    Thanks
    HS

    Too bad Lily didn't follow up on TommyReynolds' suggestion. I'm also having the same problem ( I think ).
    TommyReynolds does say how to get the installed list, but doesn't say how to find out what's missing.
    My settings:
    [root@OEL5u4DB11gR2 X11]# rpm -qa 'xorg*font*' | /bin/sort
    xorg-x11-fonts-100dpi-7.1-2.1.el5
    xorg-x11-fonts-75dpi-7.1-2.1.el5
    xorg-x11-fonts-base-7.1-2.1.el5
    xorg-x11-fonts-ISO8859-1-100dpi-7.1-2.1.el5
    xorg-x11-fonts-ISO8859-1-75dpi-7.1-2.1.el5
    xorg-x11-fonts-misc-7.1-2.1.el5
    xorg-x11-fonts-truetype-7.1-2.1.el5
    xorg-x11-fonts-Type1-7.1-2.1.el5
    xorg-x11-font-utils-7.1-2
    [root@OEL5u4DB11gR2 X11]# uname -a
    Linux OEL5u4DB11gR2 2.6.18-164.el5 #1 SMP Thu Sep 3 02:16:47 EDT 2009 i686 i686 i386 GNU/Linux
    [root@OEL5u4DB11gR2 X11]# xclock &
    [1] 5950
    [root@OEL5u4DB11gR2 X11]# Warning: Missing charsets in String to FontSet conversion
    I would greatly appreciate any input.
    Kind regards,
    UFP1701

  • Error Warning: Missing charsets in String to FontSet conversion

    Hi
    I was installed aqualogic BPM version 6.0 MP4 for weblogic on solaris 10 SPARC
    when i ran albpmadmcenter i got an error
    bash-3.00$./albpmadmcenter
    Warning: Missing charsets in String to FontSet conversion
    Warning: Missing charsets in String to FontSet conversion
    any solution?
    thanks.

    I just found this on the web at http://www-01.ibm.com/support/docview.wss?uid=swg21146408.
    When I ran "export LC_ALL=C" and then ran xclock, I did not get the message. This might work for you.
    Paul

  • Problem with String to Int conversion

    Dear Friends,
    Problem with String to Int conversion
    I am having a column where most of the values are numeric. Only 4 values are non numeric.
    I have replaces those non numeric values to numeric in order to maintain the data type.
    CASE Grade.Grade  WHEN 'E4' THEN '24'  WHEN 'E3' THEN '23'  WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade  END
    This comes the result as down
    Grade
    _0_
    _1_
    _10_
    _11_
    _12_
    _13_
    _14_
    _15_
    _16_
    _17_
    _18_
    _19_
    _2_
    _20_
    _21_
    _22_
    _23_
    _24_
    _3_
    _4_
    _5_
    _6_
    _7_
    _8_
    _9_
    Refresh
    Now I want to convert this value to numeric and do some calculation
    So I changed the formula as below
    cast (CASE Grade.Grade  WHEN 'E4' THEN '24'  WHEN 'E3' THEN '23'  WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade  END as INT)
    Now I get the following error
    View Display Error
    _     Odbc driver returned an error (SQLExecDirectW)._
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    _State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1722, message: ORA-01722: invalid number at OCI call OCIStmtFetch. [nQSError: 17012] Bulk fetch failed. (HY000)_
    SQL Issued: SELECT cast ( CASE Grade.Grade WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' ELSE Grade.Grade END as Int) saw0 FROM "Human Capital - Manpower Costing" WHERE LENGTH(CASE Grade.Grade WHEN 'E1' THEN '20' WHEN 'E2' THEN '21' WHEN 'E3' THEN '22' WHEN 'E4' THEN '23' ELSE Grade.Grade END) > 0 ORDER BY saw_0_
    Refresh
    Could anybody help me
    Regards
    Mustafa
    Edited by: Musnet on Jun 29, 2010 5:42 AM
    Edited by: Musnet on Jun 29, 2010 6:48 AM

    Dear Kart,
    This give me another hint, Yes you are right. There was one row which returns neither blank nor any value.
    I have done the code like following and it works fine
    Thanks again for your support
    Regards
    Code: cast (CASE (CASE WHEN Length(Grade.Grade)=0 THEN '--' ELSE Grade.Grade END) WHEN 'E4' THEN '24' WHEN 'E3' THEN '23' WHEN 'E2' THEN '22' WHEN 'E1' THEN '21' when '--' then '-1' ELSE Grade.Grade END as Int)

  • I have proubleam with string to date conversion, i out put date fromat is 2012-04-30T23:48:55.727-07:00 . so please help me the format conversion

    i have proubleam with string to date conversion, i out put date fromat is 2012-04-30T23:48:55.727-07:00 . so please help me the format conversion.
    i wrote the method but it not workig
    My method is
    -(NSDate *)dateformstr:(NSString *)str
    NSString *date = [str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSDateFormatter *dateFormate = [[NSDateFormatter alloc] init];
      [dateFormate setDateFormat:@"yyyy-MM-dd'T'HH:mm:sssZZZZ"]
    // NSDate *formatterDate = [dateFormate  dateFromString:str];
        return formatterDate;
    but i did not the value and if i try othere formate i is working but my requiremet format is 2012-04-30T23:48:55.727-07:00.
    can any help it out in this senario.

    Sorry Butterbean, but I'm interested in the answer to your question myself.
    I've spent a few hours transfering my library from one computer to another and then find out that my ratings didn't transfer. Like you, I've spent many hours rating my 2000+ songs. I'm sure you have more, nevertheless, I want to find out how to get those ratings. They still show in my iTunes on my laptop but, when I go to the iTunes folder and display the details of at song, no rating is there. If you find out how to get them to display there in the iTunes folder, it seems that would be the key.
    Hope you get your answer soon.

  • Warning: Missing charsets in String to FontSet conversion

    Hi ,
    I just installed eclipse on a linux box abd while running eclipse i get the folowwing error -
    Warning: Missing charsets in String to FontSet conversion
    and the font looks distorted with blocks between alphabets

    did you fix this problem? I'm getting the same error :
    [bmollett@hextall ~]$ Warning: Missing charsets in String to FontSet conversion
    Warning: Cannot convert string "-*-*-medium-r-*-*-*-120-*-*-*-*-*-*" to type FontSet
    Warning: Missing charsets in String to FontSet conversion
    Warning: Unable to load any usable fontset
    Warning:
    Name: FONTLIST_DEFAULT_TAG_STRING
    Class: XmRendition
    Conversion failed. Cannot load font.
    Warning:
    Name: FONTLIST_DEFAULT_TAG_STRING
    Class: XmRendition
    Conversion failed. Cannot load font.
    Warning:
    Name: FONTLIST_DEFAULT_TAG_STRING
    Class: XmRendition
    Conversion failed. Cannot load font.
    Warning: No font found.
    Warning:
    Name: FONTLIST_DEFAULT_TAG_STRING
    Class: XmRendition
    Conversion failed. Cannot load font.
    Warning:
    Name: FONTLIST_DEFAULT_TAG_STRING
    Class: XmRendition
    Conversion failed. Cannot load font.
    Warning:
    Name: FONTLIST_DEFAULT_TAG_STRING
    Class: XmRendition
    Conversion failed. Cannot load font.
    JVMDG217: Dump Handler is Processing Signal 11 - Please Wait.
    JVMDG303: JVM Requesting Java core file
    JVMDG304: Java core file written to /home/bmollett/javacore.20050804.102118.11000.txt
    JVMDG215: Dump Handler has Processed Exception Signal 11.
    I've tried both motif and gtk2 versions ...

  • HELP: String to double conversion?

    Hello,
    I want to convert a String to a double, and then use this double for a calculation. The conversion seems to be ok, but I get an error with the calculation... Please HELP!
    A part of my code:
    double angle;
    Double converted_angle;
    angle=jTextField2.getText();
    converted_angle= Double.valueOf(angle);
    double theta = cos(Math.PI/180*converted_angle);
    ERROR: "operator * cannot be applied to double,java.lang.Double"
    Thanks in advance.

    This is happening because you want to multiply a Double object, instead of a double value. Do this:
    Double converted_angle; should be double converted_angle;
    converted_angle= Double.valueOf(angle); should be changed to converted_angle = Double.parseDouble(angle);
    angle should probably be a String.
    check this link for your options:
    http://java.sun.com/j2se/1.4/docs/api/java/lang/Double.html

  • String to int conversion

    can n e body tell me how can i convert a String to an int

    always remember to use the try/catch block with thins that throw exceptions
    String gg;
    int in;
    try{  
    gg = "30";
       in = Integer.parseInt(gg);
    catch(NumberFormatException e){ 
      e.printStackTrace();
    }Ant

  • String to XML conversion using XSLT

    Hi all,
    I have a scenario when my source input XML is in the form of a string which needs to be transformed into an XML target fields.
    I am using XSLT mapping to do that and its working but unfortunately, input XML contain xml declaration <?xml version='1.0'?>. Because of which it fails.
    I need to remove this. Can any body please suggest how to do this?
    Any help will be appriciated.
    Regards
    -Kulwant

    Hi,
    Refer these links
    XI/PI: Convert Flat File to Deeply Nested XML Structures Using Only Graphical Mapping
    Regards,
    Surya

  • String to XML conversion without fatal error?

    Can one of you tell me how to convert the folowing string to XML without fatal error?
    String s1 = "<?xml version="1.0" encoding="UTF-6.0"?> <Main> <sub> 12345 </sub> </Main>".

    First, you can't have double quotes (") in a string like that, you need to do (\") instead. If you wrote the below line and saved the file as a file_name.xml It should work fine.
    import java.io.*;
    public class yourclass{
         public static void writeXML(){
              try{
                   File xmlOut = new File("file_name.xml");
                   BufferedWriter xmlWriter = new BufferedWriter(new FileWriter(xmlOut));
                   String s1 = "<?xml version=\"1.0\" encoding=\"UTF-6.0\"?> <Main> <sub> 12345 </sub> </Main>";
                   // you can concatenate the strings using a + 
                   // the \n will create a new line in the file
                   String s2 = "<?xml version=\"1.0\" encoding=\"UTF-6.0\"?>" + "\n" +  "<Main> <sub> 12345 </sub> </Main>";
                   xmlWriter.write(s1);
                   xmlWriter.close();
              }catch(Exception ex){
                   ex.printStackTrace();
    }There are a few other ways to do this, the one above is sloppy. One is XStream to convert xml to Java objects and back again. http://xstream.codehaus.org/tutorial.html

  • String to Date Conversion

    Hi,
    I need to convert a string to a Date format.
    Input string can be in 2 formats: "mm-dd-yy" and "yyyy-mm-dd".
    Thanks....

        java.util.Date date = new java.util.Date();  
        sd = new java.text.SimpleDateFormat("yyyy-MM-dd");
        System.out.println(sd.format(date));  
        sd = new java.text.SimpleDateFormat("MM-dd-yy");
        System.out.println(sd.format(date));  

  • String utf-16 conversion

    Hello,
    I call rfc (via xi) and get result as flat xml String from r/3.
    This string contains english and hebrew characters. The english is o.k. but the value nodes in hebrew looks like " &#1523; &#1523;&#65533;&#1523;™ &#1523;&#65533;&#1523;™&#1523; &#1523;™&#1523;&#65533;&#1523;¨&#1523;&#1523;˜/&#1523;™&#1523;’&#1523;&#65533;&#1523;&#65533; "
    how can i convert the string in order to see my language characters?
    I think the source unicode is utf-8, and i need to convert it to utf-16 but i'm not sure about that nor how to do that.
    Thanks for your help.
    Roni.

    Hi Roni,
    If your RFC returns an XML file as a java.lang.String object, the String itself is by definition UTF-16. To see if the XML file is correct, you could write it to disk and open it with your favourite text editor. Something like this.
    private void save(String xml) throws IOException {
      OutputStream out = new FileOutputStream(new File("/tmp/result.xml"));
      out.write(xml.getBytes("UTF-8"));
      out.close();
    Or whatever supported encoding you like and that's supported by your text editor, e.g. ISO-8859-8 is Latin/Hebrew Alphabet; see http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
    Obviously, to correctly see the characters you need the necessary fonts too.
    In case the above doesn't work, it means the xml String you receive from the RFC call is already corrupt. However, if it does work, the RFC as such works correctly.
    The next step is likely to parse the XML to extract the information you need and store it in your Web Dynpro context. An XML parser usually expects bytes (a java.io.InputStream) as input, which means you need to convert the String to bytes and by doing that, you need to choose a character encoding. It could be something like the following.
    SAXParserFactory.newInstance().newSAXParser().parse(new ByteArrayInputStream(xml.getBytes("UTF-8")), handler);
    Note that the character encoding you specify here does make a difference. It should be the same, in order not to "confuse" the XML parser, as defined in the XML file's document type declaration, e.g. <?xml version="1.0" encoding="UTF-8"?>
    BTW, what exactly do you do with the received XML to obtain the value nodes?
    Kind regards,
    Sigiswald

  • String to timestamp conversion

    I have a string of the format yyyyMMdd:hh:mm:ss.SSSSS.
    I need to convert it to a timestamp value of
    the format dd-MMM-yy hh.mm.ss.SSSSS.
    I tried the following
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd:hh:mm:ss.SSSSS");
    java.util.Date date = sdf.parse(stdate);
    java.sql.Timestamp t = new java.sql.Timestamp(date.getTime());
    but it didnt work.
    Any help will be greatly appreciated.

    I have a string of the format
    yyyyMMdd:hh:mm:ss.SSSSS.
    need to convert it to a timestamp value of
    he format dd-MMM-yy hh.mm.ss.SSSSS.
    I tried the following
    SimpleDateFormat sdf = new
    SimpleDateFormat("yyyyMMdd:hh:mm:ss.SSSSS");
    java.util.Date date = sdf.parse(stdate);
    java.sql.Timestamp t = new
    java.sql.Timestamp(date.getTime());
    but it didnt work.
    Any help will be greatly appreciated.
    I have a string of the format
    yyyyMMdd:hh:mm:ss.SSSSS.
    need to convert it to a timestamp value of
    he format dd-MMM-yy hh.mm.ss.SSSSS.Timestamps do not have a format - they are just a point in time. The toString() method will return a String representing the Timestamp in some format but this is not the same as having a format.
    I tried the following
    SimpleDateFormat sdf = new
    SimpleDateFormat("yyyyMMdd:hh:mm:ss.SSSSS");
    java.util.Date date = sdf.parse(stdate);
    java.sql.Timestamp t = new
    java.sql.Timestamp(date.getTime());
    but it didnt work.What do you mean by "didn't work"?

  • How to convert Raw data to string in Unicode conversion

    Hi All,
    I want to convert my report in Unicode while conversion we are getting error as "The key of internal table "IRESBD" contains components of type "X" or "XSTRING". The "READ TABLE IRESBD" statement is not permitted for such tables"
    Regards,

    Thanks for reply ,
    I tried to use the FM but not able to get any value ? is this FM converts all internal table or used to convert one field value.
    My report is Unicode so i need to internal table while reading Internal table which contains fiield as GUID_16 type Raw is showing error.
    Regards,

  • String to char conversion

    How do I convert a string I have (I am sure its one character) in to char?

    you must mean char foo, instaead of String!
    char foo = "bar".toCharArray()[0];

Maybe you are looking for

  • Changing the password of scom services account.

    hello experts, I have installed Single  SCOM Management Server with following services accounts , all the Domain Users account : Action Account Data Access Service Data Reader Data Ware Write Service also monitoring some of Computers. But now I have

  • BEx 7 Workbook Template Issue

    Dear Gurus! Has anybody experience with designing an excel master template in BEx 7? I have designed a template on basis of a query, created a corporate theme, positioned the design items, inserted a logo etc. and saved the workbook on the BW server.

  • Data Source for DAR01 field in HR.

    Hi Guys, I have the following fields in HR area PA. First three fields are for D.O.J. group and last field is for Date type from table PA0041. I didn't find any info object and data source for these fields in BI. Can any one help me out for finding s

  • CLAD Certified LabVIEW developer with 6 months exp seeking for Job in LabVIEW/Embedded

    Hi, I am currently working at CC Engineers Pvt. Ltd. as a software developer in LabVIEW and seeking for a job change. Please find the skillset, project  and certification information below. Academics: B.E. Electronics with 70.90% on degree.  Objectiv

  • New mac pro (2014) specs for production company help

    Hey guys new to the forum! I work for a production company that makes mainly online corporate video and motion graphics, lots of character animation, typography pieces and bits and pieces of 3D work with cinema 4d r14. We currently work on 2009 mac w