Go to advanced search

by woodystanford
Tue Apr 18, 2017 12:06 am
Forum: C/C++
Topic: Socket Any One?
Replies: 7
Views: 1244

Re: Socket Any One?

Written on Ubuntu, a true select-based socket client/server. client4.c #include <stdio.h> #include <string.h> #include <stdlib.h> int done=0; //done flag for main program loop //exloded command line char exploded[10][255]; //gets replacement char *gets2(char *s, int buffsize) { //fgets(s, buffsize ,...
by woodystanford
Fri Apr 07, 2017 12:46 pm
Forum: C/C++
Topic: Socket Any One?
Replies: 7
Views: 1244

Re: Socket Any One?

OK, here is the minicomm-like version. What you do is you copy and paste the code to client2.c and server2.c and compile and execute. (remember its like a web server and a browser, you have to start the server2 first THEN execute client2). It does illustrate bidirectional bound socket communication,...
by woodystanford
Fri Apr 07, 2017 9:56 am
Forum: C/C++
Topic: Socket Any One?
Replies: 7
Views: 1244

Re: Socket Any One?

OK, if you want a great, complete primer on how to do a socket, I recommend the web page that I ended up selecting. You have to understand that UN*X started out in academia and to a certain extent defence (a la DARPAnet) so the best documentation would a lot of times come from an academic source: ht...
by woodystanford
Fri Apr 07, 2017 9:44 am
Forum: C/C++
Topic: Socket Any One?
Replies: 7
Views: 1244

Socket Any One?

I've done sockets before...but not too many of them. I think the reason why we look at them as esoteric is because the conventional wisdom is we don't need that many of them (as in we always work it out when a new web browser is being developed, or an FTP server, or whatever). I personally would lov...
by woodystanford
Fri Apr 07, 2017 5:12 am
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

OK, so what's the power with this TABLE approach? Make a function called savetables() and loadtables() (for now, horribly inefficent and limited by the R-Pi's RAM) boom there you go, you have the ability to save and load you data. Maybe break it out by saving and loading by table to make it a little...
by woodystanford
Fri Apr 07, 2017 3:49 am
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

OK, I can tell that a lot of you are like white-hot on these R-Pi C....business apps. lol jk While not part of C proper, let's cover some basic database theory to give you some ideas. From a database paradigm, everything is stored in "tables". These 2-dimensional arrays of information are the core o...
by woodystanford
Fri Apr 07, 2017 2:45 am
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

**** END OF LESSONS - you are now a traditional C programmer - congrats ( :D :D :D hands imaginary certificate kind of thing :D :D :D ) ***** Ok (enthusiastically), guess what you now have everything you need to start pumping out the...business apps. Let's talk conceptually how this is done. Let's s...
by woodystanford
Fri Apr 07, 2017 1:28 am
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

OK, text files. This part is easy if you've mastered the material in the last post. Binary, or data files, are great for some things, poor for others. A lot of times you'll want to use a text file. Use the same fopen() and fclose() functions, but use fprintf() and fscanf() instead of fread() and fwr...
by woodystanford
Fri Apr 07, 2017 1:01 am
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

A lot of you want to know how to read and write files. Here is a "loader" for that. You just have to memorize 4 functions: fopen(), fwrite(), fread(), fclose(). UN*X tries to treat everything in terms of streams so that what you learn with one device (in this case the filesystem) you can apply it di...
by woodystanford
Wed Mar 22, 2017 12:45 am
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

Been thinking for a bit...bear with me on this one, please. With all the new technologies out there, a lot of the stuff discussed here seems...quaint. But imo there is a lot to be learned with just straight, traditional C language. I personally don't have a problem with interacting, through shell, i...
by woodystanford
Wed Mar 22, 2017 12:07 am
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

stderr wrote:
DavidS wrote:You see if you ignore these keywords you castrate the language.
Maybe he's saying that you might wait to deal with those things until you'd first got a toe hold on the Matterhorn of C?
Exactly. Thank you, stderr.
by woodystanford
Tue Mar 21, 2017 10:38 pm
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

Ok, now the first hard thing you'll encounter here. I'm all about easy but you gotta eat your peas now. You might want to take a break and approach this fresh as this is what really determines your proficiency at C, the principle that I'm going to talk about here, the grasp of it. Referencing and De...
by woodystanford
Tue Mar 21, 2017 10:16 pm
Forum: C/C++
Topic: Learning C in 5 minutes
Replies: 49
Views: 6349

Re: Learning C in 5 minutes

Ok, I said we would cover structures. Important in any serious discussion on C imo. Here is an example of a structure: struct customer_type { long customerid; customername char[255]; phonenumber char[255]; comments[255]; } customer; Just take a good look at how it works...instinctually I mean. You n...
by woodystanford
Tue Mar 21, 2017 8:06 pm
Forum: C/C++
Topic: Embedded Web Servers
Replies: 14
Views: 3964

Re: Embedded Web Servers

Look here's my point (and the point I'm thinking Mr. Torvaldes is trying to make) is one of these Pi's gotta find itself into a fridge eventually, if you know what I mean. (Holds it up by its USB teather like a school teacher). Look at it, its about the size of a postage stamp or there abouts. And i...
by woodystanford
Tue Mar 21, 2017 6:51 am
Forum: Graphics programming
Topic: BMP Out in C
Replies: 25
Views: 5504

Re: BMP Out in C

Yes, if you are running it in HDMI mode with a keyboard, Peter. However some of us "consider that beneath us" as in I use it as a UN*X host controller only shell accessing into it. In most IoT applications I doubt if every Pi is going to have a keyboard and a display on it (as a host of zeros could ...
by woodystanford
Mon Mar 20, 2017 10:46 pm
Forum: Graphics programming
Topic: BMP Out in C
Replies: 25
Views: 5504

Re: BMP Out in C

I just now checked the number of hits that this thread is getting. So it seems that my intuition regarding the lingering over-all UN*X community issue of having basic 2D support is correct (to explain the interest). Yes, it seems that my current approach comes out with something passable in some sit...
by woodystanford
Mon Mar 20, 2017 8:34 pm
Forum: Graphics programming
Topic: BMP Out in C
Replies: 25
Views: 5504

Re: BMP Out in C

OK, I'm not understanding, gentlemen, what is your concern(s)? Please be literal and explicit and I will rectify those issues I can. I'm starting to sense that I'm not getting what you are trying to say. Am I aware of GD....of course, in fact it is my graphics library of choice. My point here is tha...
by woodystanford
Mon Mar 20, 2017 6:21 pm
Forum: Graphics programming
Topic: BMP Out in C
Replies: 25
Views: 5504

Re: BMP Out in C

Thanks Gordon. I WILL get the wall and extra switches in my compile/link sequence btw. Also wanted to talk to the rest of you about what you mentioned but am on a mission... OK, one of the things I do is a lot of physics (cosmology and quantum mechanics) and one of the things that my fellows drool o...
by woodystanford
Mon Mar 20, 2017 3:01 pm
Forum: Graphics programming
Topic: BMP Out in C
Replies: 25
Views: 5504

Re: BMP Out in C

OK, here is a screen video of what this 2D graphics thingy does (to show the casually interested what it does). https://woodystanford.tinytake.com/sf/MTQzMzE5OF81MTE5MzM1 The top window is the Windows Client for it and the bottom window is the cmd cli for Windows. Realtime.exe was compiled (with gcc...
by woodystanford
Mon Mar 20, 2017 1:29 pm
Forum: Graphics programming
Topic: BMP Out in C
Replies: 25
Views: 5504

Re: BMP Out in C

Let me say this as well. I thought that adding and using a RAM Disk would make it less jerky. It doesn't; found out empirically that Windows 10's filesystem is RAM-buffered enough that it will work the same whether you write to hard drive or RAM drive. How did I verify this? I used ImDisk to mount a...
by woodystanford
Mon Mar 20, 2017 1:24 pm
Forum: Graphics programming
Topic: BMP Out in C
Replies: 25
Views: 5504

Real-Time 2D Graphics support for UN*X CLI's

OK, got the COOLEST thing for you guys and gals. How does Real-Time 2D graphics support for UN*X sound? Its definitely fun to play with but very jerky. The client runs on your Windows 10 PC. Its actually pretty high-performance internally but how it works you will laugh that it even works as well as...
by woodystanford
Fri Mar 17, 2017 5:55 am
Forum: C/C++
Topic: Sending a terminal command through C
Replies: 14
Views: 2802

Re: Sending a terminal command through C

This code will do it: if ((ppid=fork())==0) { printf("Child process\n"); execlp("bash","bash","./your_shell_script.sh","",NULL); return; //terminates child process } //does this block? YES! // printf("Parent process %d\n",ppid); wait(&status); If you need to fully specify the contents of your shell ...
by woodystanford
Wed Mar 15, 2017 8:29 pm
Forum: Automation, sensing and robotics
Topic: Simple Relay Circuit
Replies: 13
Views: 4556

Re: Simple Relay Circuit

Image

Not tested by me, just off the Inet. As in use at own risk. You could have a PIC or an Arduino for the lone exciting chip on the far left and control serially I suppose.
by woodystanford
Wed Mar 15, 2017 5:09 am
Forum: Automation, sensing and robotics
Topic: Simple Relay Circuit
Replies: 13
Views: 4556

Re: Simple Relay Circuit

The Point Where you can develop small function squares of circuits like this, you can develop larger subsystems and systems like robots, drones, even stuff like mock-up nanosats and the like. https://woodystanford.files.wordpress.com/2015/06/4_relay_board1.png You can even fairly easily develop boa...
by woodystanford
Wed Mar 15, 2017 4:42 am
Forum: Automation, sensing and robotics
Topic: Simple Relay Circuit
Replies: 13
Views: 4556

Re: Simple Relay Circuit

OK, a synopsis, basically what you do is you breadboard out the preceding circuit after ordering the parts from Mouser or Digikey or wherever (remember to also order your battery holders, any case and discretes like resistors and diodes...a lot of time I forget). Breadboarding critical in that you b...

Go to advanced search