User Profile

Collapse

Profile Sidebar

Collapse
therock112
therock112
Last Activity: Dec 1 '06, 02:46 AM
Joined: Nov 26 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • therock112
    replied to how to convert array of uchar to string
    in C
    Yes it works!!!

    now, how do i go about copying int type array items into unsigned char type array?

    is the following legit syntax?

    arrayofuchars[deviceid][index] = arrayofints[deviceid][index];

    or

    arrayofuchars[deviceid][index] = (unsigned char) arrayofints[deviceid][index];...
    See more | Go to post

    Leave a comment:


  • therock112
    replied to how to convert array of uchar to string
    in C
    I get some strange result, most of characters are 0's except the last 2 digits which gets converted correctly.....n ot sure why

    when row[0] is 36000800402AE11 0
    arrayofuchars[NumDevices] has 000000000000001 0

    and it does this for all items, not sure why only the 10 gets converted correctly.

    my exact syntax is as follows:

    Code:
    sscanf(row[0],"%02X%02X%02X%02X%02X%02X%02X%02X",&arrayofuchars[NumDevices][7],&arrayofuchars[NumDevices][6],&arrayofuchars[NumDevices][5],&arrayofuchars[NumDevices][4],&arrayofuchars[NumDevices][3],&arrayofuchars[NumDevices][2],&arrayofuchars[NumDevices][1],&arrayofuchars[NumDevices][0]);
    ...
    See more | Go to post

    Leave a comment:


  • therock112
    replied to how to convert array of uchar to string
    in C
    I have tried the following without much luck:

    Code:
    mysql includes;
    declare and init other varibles etc;
    
    int NumDevices =0;
    
    other mysql related initialization, not shown to keep things simple;
    
    sprintf(query, "SELECT distinct ucase(deviceid) from tlogs where devicetype='10'");
    
    mysql_real_query(&mysql,query,(unsigned int)strlen(query));
    
    res = mysql_use_result(&mysql);
    ...
    See more | Go to post

    Leave a comment:


  • therock112
    replied to how to convert array of uchar to string
    in C
    Continuing the fun,

    I now want to do the reverse of course, read from mysql database, and copy the deviceid into a variable, resulting in the same format.

    when I receive the mysql result, the result is in string format, how do i go about converting those exact address such as 3500080047222E1 0 and correctly placing them in an array?...
    See more | Go to post

    Leave a comment:


  • therock112
    replied to how to convert array of uchar to string
    in C
    horace1, thats exactly what I was looking for.....thanks a million

    following is what I came up with, and it works!!!!


    sprintf(devicea ddress,"%02x%02 x%02x%02x%02x%0 2x%02x%02x",Fam ilySN[i][7],FamilySN[i][6],FamilySN[i][5],FamilySN[i][4],FamilySN[i][3],FamilySN[i][2],FamilySN[i][1],FamilySN[i][0]);

    sprintf(query, "INSERT into tlogs (id, deviceid, devicetype, temp, logtime, logdate)...
    See more | Go to post

    Leave a comment:


  • therock112
    replied to how to convert array of uchar to string
    in C
    Sure.

    My following code is a direct copy from Dallas/Maxim's site, I have tried to incorporate the Mysql c api in it as well so I could directly send the measured temperature information to a sql table.

    for the fullsource code from dallas, please visit the following site to get their sdk
    :
    http://files.dalsemi.com/auto_id/pub...inuxgnu300.zip

    Following is my hacked c code, please bear...
    See more | Go to post

    Leave a comment:


  • therock112
    replied to how to convert array of uchar to string
    in C
    any ideas, anyone???
    See more | Go to post

    Leave a comment:


  • therock112
    started a topic how to convert array of uchar to string
    in C

    how to convert array of uchar to string

    hello

    I am new to C and not sure how to go about getting the following accomplished:

    I have the following c code, under centos ver 3.4, using gnu gcc to compile:

    uchar sn[8];

    // readings

    sn[0] = 0x10;
    sn[1] = 0x2E;
    sn[2] = 0x22;
    sn[3] = 0x47;
    sn[4] = 0x00;
    sn[5] = 0x08;
    sn[6] = 0x00;
    sn[7] = 0x35;

    I want to convert...
    See more | Go to post
No activity results to display
Show More
Working...