User Profile

Collapse

Profile Sidebar

Collapse
JSchaenzle
JSchaenzle
Last Activity: Jul 8 '13, 07:27 PM
Joined: Sep 11 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • JSchaenzle
    replied to Converting a char to an int
    in C
    Thanks, I am trying to program a "Rabbit" mcu and it uses a language called Dynamic C, which is JUST like C. Your suggestion with the N4 - 48 worked. I think the problem is like you say, atoi() is looking for a null terminated string and when I pass it a single character it is not null terminated...
    See more | Go to post

    Leave a comment:


  • JSchaenzle
    started a topic Converting a char to an int
    in C

    Converting a char to an int

    I am trying use the following code to convert a char to an int but it's not working.
    For some reason PosToMoveTo contains 4000 instead of 4. I am not sure why...

    main()
    {
    int i;
    int dis;
    char * Distance;
    char N0, N1, N2, N3, N4;
    int PosToMoveTo;
    ReceivedStr = "P0004";

    N0 = ReceivedStr[0];
    N1 = ReceivedStr[1];...
    See more | Go to post

  • JSchaenzle
    replied to Passing strings to and from functions
    in C
    ...I see. That makes sense. Thank you!
    See more | Go to post

    Leave a comment:


  • JSchaenzle
    started a topic Passing strings to and from functions
    in C

    Passing strings to and from functions

    I am trying to pass a string to a Mid() function, return a portion of the string, and then convert that portion to an int. My attempt looks like this..

    char * ReceivedStr;
    char * Mid(char * inString, int Start, int Length );


    main()
    {
    int i;
    int dis;
    char * Distance;
    ReceivedStr = "Move125";

    Distance = Mid(ReceivedStr , 4, 3);...
    See more | Go to post
No activity results to display
Show More
Working...