Go to advanced search

by swampdog
Sat Oct 15, 2016 2:03 am
Forum: C/C++
Topic: Learning C++ for the first time. Feedback?
Replies: 6
Views: 877

Re: Learning C++ for the first time. Feedback?

I've a decade old "twiddly" co-ordinate class that serves no purpose other than being an exercise. It's a template'd thing.
by swampdog
Sat Oct 15, 2016 1:11 am
Forum: C/C++
Topic: The MagPi does C :-)
Replies: 124
Views: 12683

Re: The MagPi does C :-)

Can a discussion of the history of C go in another thread please ? Let's leave this one clear to discuss the content of any future tutorials or books. PeterO Agreed. Back to the plot. The most obvious complex C item, is strings. Every man & his dog has written "a brilliant string library". The conc...
by swampdog
Sat Oct 15, 2016 12:57 am
Forum: C/C++
Topic: Cross-Compile missing ld-linux-armhf.so.3
Replies: 2
Views: 1385

Re: Cross-Compile missing ld-linux-armhf.so.3

No. Both natively and within my cross (under centos 6) "ld-linux-armhf.so.3" points to some variant of "ld-2.*.*.so". Native.. $ lc -d /lib/arm-linux-gnueabihf/ld* -rwxr-xr-x 1 root root 134448 Apr 2 2016 /lib/arm-linux-gnueabihf/ld-2.19.so lrwxrwxrwx 1 root root 10 Apr 2 2016 /lib/arm-linux-gnueabi...
by swampdog
Fri Oct 14, 2016 10:49 am
Forum: C/C++
Topic: The MagPi does C :-)
Replies: 124
Views: 12683

Re: The MagPi does C :-)

Back in K&R I'd have happily written "void main(..)" K&R C does not include void. That came afterwards and is included in the ANSI standard. In the years following the publication of K&R C, several features were added to the language, supported by compilers from AT&T (in particular PCC[15]) and som...
by swampdog
Fri Oct 14, 2016 7:06 am
Forum: C/C++
Topic: Learning C++ for the first time. Feedback?
Replies: 6
Views: 877

Re: Learning C++ for the first time. Feedback?

Here's some ideas on how to get more work out of less code. It's far from perfect btw. Just hints.. #ifndef TC #define TC class TestClass { private: int value; public: TestClass (); TestClass (int x); TestClass (const TestClass&); TestClass & operator=(const TestClass&); TestClass & operator*=(const...
by swampdog
Fri Oct 14, 2016 5:32 am
Forum: C/C++
Topic: The MagPi does C :-)
Replies: 124
Views: 12683

Re: The MagPi does C :-)

Thanks @jojopi, I was beginning to think I was the voice in the wilderness . Well, it's swings & roundabouts. Back in K&R I'd have happily written "void main(..)" because it meant you didn't care about the return value. Obviously "int main(..) {/*code*/;return 0;}" is the most portable way to proce...
by swampdog
Fri Oct 14, 2016 4:41 am
Forum: Raspbian
Topic: Create bootable windows usb on PI3 Rapsbian
Replies: 7
Views: 1828

Re: Create bootable windows usb on PI3 Rapsbian

Fwiw, here's the 'winusb' script out of the build I performed.. #!/bin/bash # Config # Quit the script if a command fails set -o errexit # Quit the script if a non-declared variable is referenced set -o nounset # Script path set +o nounset if [ "$scriptPath" = "" ]; then scriptName=$(basename $(read...
by swampdog
Wed Oct 12, 2016 11:18 pm
Forum: Raspbian
Topic: Create bootable windows usb on PI3 Rapsbian
Replies: 7
Views: 1828

Re: Create bootable windows usb on PI3 Rapsbian

No idea if it works (a fork of the original) but it can be made to build on the rpi.. https://github.com/slacka/WinUSB http://www.webupd8.org/2016/06/make-bootable-windows-10-usb-install.html ..and it turns out the non-gui part , 'winusb' is just shell script. Caveat is you'll need to be reasonably ...
by swampdog
Wed Oct 12, 2016 10:22 pm
Forum: C/C++
Topic: C++ program executed from PHP not exporting GPIO properly
Replies: 4
Views: 734

Re: C++ program executed from PHP not exporting GPIO properl

I don't know php but replace your code with a bit of shell script which executes your code. That will allow you to edit the shell script to see what is going on.

#!/bin/bash
touch /tmp/z
echo $PATH
[etc]
by swampdog
Wed Oct 12, 2016 10:05 pm
Forum: C/C++
Topic: Put a variable in system () call? Or better way?
Replies: 6
Views: 702

Re: Put a variable in system () call? Or better way?

Just a note of warning. If you intend to have it respond to commands from the outside world you'll need some security in order to prevent it responding to anything but you. ;-)
by swampdog
Wed Oct 12, 2016 9:56 pm
Forum: Beginners
Topic: Port Forward on Pi acting as Wireless to Wired Bridge
Replies: 5
Views: 876

Re: Port Forward on Pi acting as Wireless to Wired Bridge

If by "WWAN" you mean something which tells you about the Verizon Hotspot then then you'll have to ask someone who has experienced that system. Unfortunately from my point of view there's one of two possibilities: a) wlan0 is changing to 70.x.x.x b) wlan0 is staying as 192.168.1.98 and this verizon ...
by swampdog
Wed Oct 12, 2016 9:52 pm
Forum: Advanced users
Topic: cross compilation "__fixsfdi"
Replies: 7
Views: 844

Re: cross compilation "__fixsfdi"

Nope. I never tried to. I did just try with gcc 6.2 and same result. I'm sure someone else posted some detail on it but my memory is terrible so no link. :-(
by swampdog
Wed Oct 12, 2016 9:22 pm
Forum: C/C++
Topic: Question about make files and a _start warning, linker
Replies: 13
Views: 1388

Re: Question about make files and a _start warning, linker

Now that i have been reading about openCV, i understand what you mean. I downloaded the openCV zip file. And it seems to be missing stuff that i need to install separately. I was hoping i would get a bunch of source, header and object files and just copy and paste those into my project folders. But...
by swampdog
Fri Oct 07, 2016 3:37 pm
Forum: Beginners
Topic: Port Forward on Pi acting as Wireless to Wired Bridge
Replies: 5
Views: 876

Re: Port Forward on Pi acting as Wireless to Wired Bridge

There's not enough detail but it sounds like all you need is an INPUT rule to allow connections into the relevant web port.

iptables -A INPUT -i "idev" -p tcp --dport "iport" -m state --state NEW,ESTABLISHED -j ACCEPT

..where "idev" is your (iiuc) ppp0 and "iport" (probably 80).
by swampdog
Fri Oct 07, 2016 1:36 pm
Forum: C/C++
Topic: Question about make files and a _start warning, linker
Replies: 13
Views: 1388

Re: Question about make files and a _start warning, linker

You might find it useful to install an ubuntu virtual machine on your PC: vmware-player works fine for instance. That platform has the best support for cross-compiling to the rpi. I suggest this because it could save you work in the long run. I suspect your W-ARM makefile generator doesn't need to d...
by swampdog
Fri Oct 07, 2016 10:55 am
Forum: Other languages
Topic: Portable GUI C89 Programming.
Replies: 145
Views: 12221

Re: Portable GUI C89 Programming.

Coming back to the original ""portable GUI" title, it all comes back to using QT then doesn't it? They've done all the work, the source code is available, it's cross-platform and regardless of X/Wayland/WinApi etc your app will just "work" plus there are bindings for other languages like Python.
by swampdog
Thu Oct 06, 2016 10:41 am
Forum: C/C++
Topic: Generate a variable in an included file - keep it for others
Replies: 9
Views: 766

Re: Generate a variable in an included file - keep it for ot

I did that with the bar() function above. Now I'm going to be really silly.. #include <stdlib.h> #include <string.h> #include <stdio.h> typedef struct foo { char *s; void (*ctor)(struct foo*); void (*dtor)(struct foo*); struct foo* (*opeq)(struct foo*,const char[]); } FOO; void str_ctor(FOO*self) { ...
by swampdog
Thu Oct 06, 2016 1:07 am
Forum: Beginners
Topic: SSH via putty from laptop
Replies: 41
Views: 6196

Re: SSH via putty from laptop

The green light has to flash to show that the pi is booting.So i assume that it is booting properly.. But you have a point. But apart from getting a monitor, what would you suggest me ? You can get one of those USB/Serial cables. Someone will have a link to it. The USB end goes into your computer. ...
by swampdog
Thu Oct 06, 2016 12:30 am
Forum: General programming discussion
Topic: [bash] Zenity loop
Replies: 7
Views: 953

Re: [bash] Zenity loop

#!/bin/bash NAM=`basename "$0"` OUT="/tmp/""$NAM"".txt" fcp_zenity () { local title="$1" shift zenity --width=200 --height=150 --list --column "" --title="$title" "$@" } fcp_m0 () { local m=( "Go to next menu" "test" ) case "$1" in 0) fcp_zenity m0 "${m[@]}" > "$OUT" ;; *) for ((i=0;i<${#m[@]};i++)...
by swampdog
Wed Oct 05, 2016 11:10 pm
Forum: Other languages
Topic: Portable GUI C89 Programming.
Replies: 145
Views: 12221

Re: Portable GUI C89 Programming.

One of the most simple and effective GUI systems was Digital Research's GEM, as used by early Apple Mac and Atari ST micros. There was no GUI per se. What you had was an array of objects in a tree structure, drawn in a given order, with a simple clipping rectangle. It could be created manually, in c...
by swampdog
Wed Oct 05, 2016 10:34 pm
Forum: Advanced users
Topic: Remotely Access Kodi
Replies: 2
Views: 1323

Re: Remotely Access Kodi

This says not..


http://forum.kodi.tv/showthread.php?tid=210173


I must admit. It would have been handy.
by swampdog
Wed Oct 05, 2016 10:18 pm
Forum: Beginners
Topic: X Forwarding under SSH on Mac
Replies: 10
Views: 1643

Re: X Forwarding under SSH on Mac

For future reference: does that mean $DISPLAY is set appropriately or not? From the looks of it, I'd say natively $DISPLAY on MacOS X is of limited use as it points to a unix socket, but through the ssh tunnel it looks ok on the Pi (except this is Lite, I don't have X installed...) It looks like $D...
by swampdog
Wed Oct 05, 2016 10:05 pm
Forum: C/C++
Topic: Question about make files and a _start warning, linker
Replies: 13
Views: 1388

Re: Question about make files and a _start warning, linker

crt1.o by the looks of it. On a native rpi..

$ nm -A /usr/lib/arm-linux-gnueabihf/crt1.o | egrep "T[[:space:]]{1,}_start"


..yields..

/usr/lib/arm-linux-gnueabihf/crt1.o:00000000 T _start
by swampdog
Wed Oct 05, 2016 6:44 pm
Forum: C/C++
Topic: Generate a variable in an included file - keep it for others
Replies: 9
Views: 766

Re: Generate a variable in an included file - keep it for ot

Two flavours.. "foo.h" #ifndef FOO_H #define FOO_H FOO_H extern int foo; char* bar(void); #endif /* FOO_H */ "foo.c" #include "foo.h" int foo; char * bar(void) {static char s[1024]; return s; } "c.c" #include <stdio.h> #include <string.h> #include "foo.h" int main() { foo = 69; strcpy(bar(),"Hello W...

Go to advanced search