User Profile

Collapse

Profile Sidebar

Collapse
kardon33
kardon33
Last Activity: Sep 12 '11, 06:18 PM
Joined: May 2 '07
Location: Farmington Hiills, MI, USA
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • kardon33
    replied to Sign-Magnitude Method of a signed 16bit int
    in C
    Alright, thanks!
    See more | Go to post

    Leave a comment:


  • kardon33
    replied to Sign-Magnitude Method of a signed 16bit int
    in C
    Thanks for the replies.

    Yes DoBock, I am trying to use the signed-magnitude method.

    Currently when I run my program it is not encoded in that method. I am wondering if it is possible to specify the encoding method.

    Currently I am using a work around by using an unsigned 16bit and limiting the domain to 0-32767 and then manually setting the first bit using bitwise operations.

    How ever this could...
    See more | Go to post

    Leave a comment:


  • kardon33
    started a topic Sign-Magnitude Method of a signed 16bit int
    in C

    Sign-Magnitude Method of a signed 16bit int

    I am running in Linux x86 and I am wondering if there is a way to specify to use the Sign-Magnitude Method for representing a signed 16bit int.

    When i use int16_t as a data type it does not use that method but I need it to.
    See more | Go to post

  • Should I be setting up a swap partition while booting off a CF card?

    I am running Debian on a PC Engine Alix board booting off of a 4gb CF card.

    Should I be setting up a swap partition while booting off a CF card.

    Im asking because ive heard this is bad for cf cards because it increase read/writes to the cf card by quite a bit.

    What is peoples thoughts about this?
    See more | Go to post

  • kardon33
    replied to BSD Sockets - Selecting Source Address
    in C
    Thanks for the reply ashitpro, but I don't you understand the problem I am having.

    My machine can send packets to the target machine on the 10.13.0 network without a problem and the target machine can send packets/ping to my machine if it uses my 10.13.0 address. But if it uses my 10.0.0. address my network will not allow it to go.

    My problem is probably due to how my network is setup but I do not have much control over...
    See more | Go to post

    Leave a comment:


  • kardon33
    started a topic BSD Sockets - Selecting Source Address
    in C

    BSD Sockets - Selecting Source Address

    Hello Bytes,

    I am using UDP BSD sockets in my program, all is working just fine until my computer has two nics or 1 nic and one virtual nic. I am running Linux x86 Debian Squeeze.

    I have one nic pointed at my 10.0.0. network and another one at 10.13.0. network

    My outbound packets are making it to the destination on my 10.13.0 network.

    The problem is that the computer on the 10.13.0 network...
    See more | Go to post

  • kardon33
    replied to Function Pointers to Function Members
    in C
    Thanks for the reply that will do it.

    However is it possible to have Class B be more vague when setting up the triggers.

    What I mean by that is if I want say Class C to set Class B's trigger then I would need two Class B set trigger methods and their respected variables. One with

    int (A::*TriggerCal lbackA)(int level);
    void setTriggerA(int (A::*TriggerCal lbackA)(int level));

    and another with...
    See more | Go to post
    Last edited by kardon33; Oct 1 '10, 04:37 PM. Reason: Opps

    Leave a comment:


  • kardon33
    started a topic Function Pointers to Function Members
    in C

    Function Pointers to Function Members

    Hello Bytes,

    I am trying to use function pointers in program with two classes.

    Here's my setup:

    In Class A I have a public method defined as [int doSomthing(int a) ].

    In Class B I need a method to set a callback for a method [ int callback(int)]

    This all works well if the callback function i give is not a member of class A or any other class.

    A.cpp:187: error:...
    See more | Go to post

  • kardon33
    replied to Linux Serial port setting for turning DTR off
    in C
    This is what ive come up with.

    After I do my port setting i use ioctl():

    Code:
        //status &= ~TIOCM_DTR;
        //status &= ~TIOCM_CTS;
    
        status |= TIOCM_DTR;
        status |= TIOCM_CTS;
    
        ioctl(fd, TIOCMSET, &status);

    Neither low or high bit status for TIOCM_DTR seems to work though?

    Is this the right wa...
    See more | Go to post

    Leave a comment:


  • kardon33
    started a topic Linux Serial port setting for turning DTR off
    in C

    Linux Serial port setting for turning DTR off

    Hello Bytes,

    I am writing a program in Linux Debian x86 to control a module.

    My only problem is that the module needs to have the DTR setting and all flow control off. I have been unable to figure out how to do this.

    This is how ive configured my port settings thus far:

    Any ideas??

    Code:
         fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
    ...
    See more | Go to post

  • kardon33
    replied to Outputing top to a file from a forked process
    in C
    No, i am not trying to get the cpu usage of any process but the entire system.

    I am getting gibberish when ran from process not still active in stdin. But I cant figure out why.
    See more | Go to post

    Leave a comment:


  • kardon33
    started a topic Outputing top to a file from a forked process
    in C

    Outputing top to a file from a forked process

    Hello Bytes,

    CPU Info: Debian Lenny x86

    I am trying to use the output of top to return cpu usage.
    - Im am actually trying to find a simple solution to gather cpu and mem usage, I have found top is the simplest to me.

    My code works great when I run it from main, however as soon as my process forks to the background when the below code runs it does not work anymore.

    Any clues why it...
    See more | Go to post

  • kardon33
    replied to getifaddrs - Memory leak
    in C
    Well i figured it out.

    I had to create a second address structure like:

    Code:
    struct ifaddrs * ipa = NULL;
    Then set ipa equal to ifAddrStruct before using ipa in the while loop.

    This allows the code to keep a copy of linked list head ifAddrStruct for freeing.

    Final Code looks like:

    Code:
    
        struct ifaddrs * ifAddrStruct, *ipa = NULL;
    ...
    See more | Go to post

    Leave a comment:


  • kardon33
    started a topic getifaddrs - Memory leak
    in C

    getifaddrs - Memory leak

    Hello Bytes,

    I am using getifaddrs from ifadddrs.h on Debian Linux (Lenny).

    Im using valgrind to check for memory leaks in my program. It seems that I have a memory leak in the code below but I cant figure out how to fix it. I thought i was freeing the address structure right but no luck.

    If I do not run the loop and call "ifAddrStru ct = ifAddrStruct->ifa_next;" I don't get a memory leak...
    See more | Go to post

  • kardon33
    started a topic shmget: Permission Denied
    in C

    shmget: Permission Denied

    Hello Bytes,

    Computer Type: Debian Lenny Linux x86

    I am trying to use shmget to create a block of shared memory. I managed to get that working fine, I run the program always in root.

    My problem though is when I want a user that is non-root to access the block I keep getting Permission Denied error.

    I set the S_IWOTH so that other users can access the block it doesn't seem to be working....
    See more | Go to post

  • What I meant was, does the local device compare its local database increment number to the other remote dbs. If it has a lower value it assumes it needs to update its database....
    See more | Go to post

    Leave a comment:


  • Yes that is close to what im looking for. Thanks

    If a device somehow misses the update message, the next time they want to read the db, they will notice that change number has increased, so they have to update themselves before they make any changes.


    One question though, if a device misses an update message how do they know that the number has increased when making a change?
    See more | Go to post

    Leave a comment:


  • Keeping files synced between multiple computers

    Hello Bytes,

    For reference I'm running Linux Debian x86 but the problem is not related to an architecture.

    I have a networked system with multiple computers (say 20-50). On each computer there is a directory that needs to be consistent with all other nodes in the system. Each computer has the privileges to make changes to the directory and those changes need to be reflected across the entire system over some amount...
    See more | Go to post

  • Nevermind, my dumb mistake.

    It was throwing a connection reset by peer error but I missing it and the next time I called send() it crashed which is ok.
    See more | Go to post

    Leave a comment:


  • I managed to figure it out, here is my solution.

    Code:
     #include <ifaddrs.h>
    
    
        struct ifaddrs * ifAddrStruct = NULL;
        void * tmpAddrPtr = NULL;
        char s[INET6_ADDRSTRLEN];
    
        getifaddrs(&ifAddrStruct);
        localAddress.clear();
    
        while (ifAddrStruct != NULL) {
            if (ifAddrStruct->ifa_addr->sa_family == AF_INET
    ...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...