Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by tomchesley

  1. tomchesley

    IP to string and break down the string

    thank you
  2. tomchesley

    IP to string and break down the string

    I want to take the ip i obtained and put it into a string that i can manipulate but i always get passing argument makes pointer from integer without a cast. I am currently using lynix with gcc as my compiler here is the current code the strcpy and sscanf lines is where it errors, it seems to...
  3. tomchesley

    String to 2 bytes

    Ok, thanx, now I got it. That worked, but what I did instead was take the original int value of fport and did my magic. how I did it was int uport; //upper order byte - will be no decimal value int lport; //lower order byte uport = fport /256; //set up the upper byte lport = fport - (uport *...
  4. tomchesley

    String to 2 bytes

    I'm not quite sure how I get 2 bytes back with that. I have to send back the bytes to the client. Will the above give me "8367" = 32 for the upper byte and 175 for the lower byte?
  5. tomchesley

    String to 2 bytes

    I am writing a modified udp server, and i almost have it working the way I want, I am only missing the ability to take a string like "8367" and have 2 bytes 32 175 returned the string is the port # I obtained from the udp server if that helps. Here is what I have at the moment #include...
  6. tomchesley

    String to hex

    Thank you Thank you that worked I tried earlier $hexval =~ s/(.|\n/sprintf(%02lx, ord $1)/eg but didnt work Your code did the trick for me
  7. tomchesley

    String to hex

    I am trying to convert a numerical string to its hex equivelent. Say for instance if $u = "1" i want $h = "01" if $u = "10" $h = "0a" and so on The $u will never go above 255 There ha to be a better way at moment i have if ($u < 10) { $h = "0".$h; } if ($u == 10) { $h = "0a"; } ...
  8. tomchesley

    more string checking

    DOH, didnt think of that thanks, but i checked both before and after for NULL Now im set
  9. tomchesley

    more string checking

    Well I thought it did the trick. but if the string doesnt have a ^ it crashs
  10. tomchesley

    more string checking

    Thanks that did the trick
  11. tomchesley

    more string checking

    that works but it changes the original value I tried char *before, *after, *hold; hold = source_p->info; before = strtok (hold, "^"); after = strtok (NULL, "^"); and it still changes the contents of source_p->info
  12. tomchesley

    more string checking

    I need a way to determine a text string if it is ok or not examples id's can be any hex number up to ffffffff a = bad missing ^id ^0 = bad missing name before ^id Tron^0 =0k valid name and id John^48d7cf5 =ok valid name an id Tonka^0^MAKIABDCCBOC/ZONA.SIT/circuit/+/4/1,8 = ok hosting game...
  13. tomchesley

    Check contents of string pointer

    using what you had, i had to set i as int before the for because gcc didnt like the int = 0 in the for loop the code only checked first letter then, dont think the temp is going to next character so i added temp++ at end of for with no luck i removed the break because it would crash after the...
  14. tomchesley

    Check contents of string pointer

    I am a newbee in C / C++ I currently have the current IRC Hybrid server 7.2.3 working successfully. I would like to modify it just a little to only allow names that are 12 characters in length and are all uppercase letters between A and P I have the length test working great, that wasnt to hard...
  15. tomchesley

    Disable update of specific records

    actually i had to do @Abs(@Integer((@Today - @Modified) / (60 * 60 * 24))) The 60 60 24 i did just to remind me how we got the 84600 when i did yours, i got an expected number error

Part and Inventory Search

Back
Top