Ok I think I messed up the function call in that, so I messed around and have tried it this way, also with no luck. It outputs "35", which I guess means it opened the port ok and sent 5 characters to...
Type: Posts; User: pgcrooks
Ok I think I messed up the function call in that, so I messed around and have tried it this way, also with no luck. It outputs "35", which I guess means it opened the port ok and sent 5 characters to...
Man this thread is awesome... and sorry abachlerm, I may have to quote you on that!
Ok, sorry was rushing to get out of work so just put the entire program on here! Here's a shortened version with just the output code.
#include <stdio.h>
#include <stdlib.h>
#include...
Salem that may explain it... Well I have now rewritten it using this guide which as far as I can tell should work on any POSIX architecture but still have no luck. Now the little moxa just outputs to...
Hey guys, just wondering if anyone here has any experience programming Moxa devices? Basically I have a Debian box which runs my little serial program fine (all it does is ouput to a serial port)...
Thanks Pete, I realise float and double are different, I just copied and pasted the same thing 3 times above. Found the problem, turns out I'm a complete idiot and used %d in the printf command. Oh...
Hey guys, sorry to bring back an old thread but I'd rather do this than start a new one!
I'm basically having trouble converting an int to a float. I've tried the following code and ever single...
Thanks guys, got it working in the end. Just used Rasta's assign technique, much easier! I forgot you could do that with single chars, just not with full strings (think that's right).
Ok, thats seems to have compiled ok! Just had to modify the order
strncpy(oldadd, &(indata[1]), 2);
Have about a million other syntax errors to fix before I can actually run the program, lets...
Humm I shall have to learn more about pointers, never really got my head around the snytax for them. Thanks anyway!
addptr = *indata[2];
strncpy = (oldadd, addptr, 2);
Right, tried that...
Hey anon, thanks for the quick reply.
The problem with strcpy or strncpy is that it copies the string from the start, I want to ignore the 1st character (ie. start at indata[1] and not indata[0]).
Hey all,
I've searched far and wide for an answer to this but have yet to find a case which is the same as mine...
Basically I have a string (indata), eg "1234" and I want to be able to copy...