Entries Tagged as ''

Part2)Project Generator for Tony Gaddis Starting out with C++ From Control Structures Through Objects

The C++ class I’m in is running at a slow pace relative for my skill sets. The class focused on chapter 5,looping. It’s just that I’ve been doing vb6 programming for a long time and I saw very little new there for me. Although my arrogance here will probably catch up with because I’m probably going to miss something subtle in the midterm because of this.

I like to automate the setup of project folders for the sample code .  I’d like to get this project generator done before the class if over, so I can use it for my class but I need the class to get it done.
Anyway..
Setting up the folders and moving the cpp files is not too painful done manually. Automated folder creation and file copy is being pushed off till later The primary focus at the moment is writing out the project files into the manually created sub-folders.
I’m going for the minimalist approach here, just to get this done and will tune it up a little bit more as time goes on.
Here’s the pseudo code
Find the name of each directory to be inserted(Currently manually created)
read the sample template file a line at a time
If something needs to be tweaked then tweak it
redirect the data into a project file where it needs to go.
So… I’ve hacked up the code a bit and what I need is the C++ equivalent to a vb6 mid$ function.. Man is this a PIA.. I think I found some discussion on that. http://computerprogramming.suite101.com/article.cfm/a_mid_string_function_for_c_and_c_

http://www.daniweb.com/forums/thread1113.html
http://www.bigresource.com/VB-Mid-C-equivalent-RESOLVED-CrKWGrf9ym.html

http://www.vbforums.com/showthread.php?t=257742 !!!! THIS IS THE ONE I USED

Uggg…..

The next issue is that I need to find the c++ equivalent to vb6 instr function. It seems that mid$ and Instr are a couple of my weapons of choice in my vb code arsenal…. I found the c++ equivalent here. http://www.cplusplus.com/reference/string/string/find/ will be the rough equivalent.

On just a side note, if found this hand xref to string functions. http://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28string_functions%29#Find

Lets see. I found some POSIX code that would read directories.  The initial code I found didn’t differentiate between folders and directories.
Hear’s link that discusses that. http://www.cplusplus.com/forum/general/4648/.

Well, while we’re at it, the initial code I had would only show the file name and not the file type. I found that answer in a wiki link:http://en.wikipedia.org/wiki/Dirent.h

Anyway.. I got a basic shell of a program to run, to automatically generate project files, but it’s really too ugly to post at the moment.
I have midterms coming up, and I don’t want screw them up by working on the fancy stuff and missing something obvious so I need to put this on the backburner for the moment.  If someone actually read’s this before I get this project done, end a comment and I’ll post it.

Part1)Project Generator for Tony Gaddis Starting out with C++ From Control Structures Through Objects

I’m really enjoying this C++ class that I’m taking which is using Tony Gaddi’s book. We’re still into the real baby stuff increment and decrement operators, but that’s ok.. I’d rather take it slow (16 weeks) and really learn some nuances about the language rather than trying to absorb it all at once. Been there done that… It doesn’t work for me.. For me anyway, reading a book or watching a video or lecture is just one component of learning. The other component is practice and developing the skill. (Time to get off the soap box and I really wish the cat would not put his ass in my face when I’m typing. I guess it’s cat speak for “I love you”. Sorry… I digress…)

The book provides the source code for all the examples on a CD. I’ve found it useful to compile the projects while studying the chapters and them hacking up the code a bit, to see if it really works the way I think it works. The parts that sucks for me is setting up the workspace and the project files to compile the projects. The first time I tried this was through the IDE which was very very tedius. Second time, I open up the workspace and project files in gedit and figure out how every thing was put together. Is used terminal session repeat functionality to setup the directory more efficiently, but it still non-value action. I would rather spend my time writing a utility that would do this automatically rather than manually. I did a quick google search to see if something like this is out there. It probably is, I just didn’t know how to ask the question.

Might as well give this a try.. If I was doing this in vb6 well, it would be a no brainer except that I’m working in Linux. Programming this in C++ is not so easy for me just quite yet.

Originally I thought I would write a portable app, since I run windows at school,work and Linux at home.. I got the impression this is doable but not quite at the skill set that I’m currently at. I found and interesting link here that discusses that. (On a side note. Once I get more proficient I bet there is a wxwidgets component that could do that).
So… for the moment, I’m scaling this back to work on my home computer and my skill sets improve, have the code get a bit more gucci.
So iInitially, Ubuntu Linux, using g++, codelite IDE.

So.. In pseudo code here is what I’m looking to do:

  1. Read appropriate CD subdirectory and put the directories/file names into arrays
  2. select chapters you wish to generator projects for
  3. generate project folders/sub-folders
  4. copy source code into the appropriate sub-folder
  5. create project files in appropriate sub-folders
  6. create a workspace files linking the appropriate project files

well…
I found some code at http://www.linuxforums.org/forum/linux-programming-scripting/26306-reading-directory-contents-files-c.html that I could hack up and get started.. Wow time flies when your having fun..

On a side note, one of the things I been thinking about is sticking Dro’s on my lathe. I wound up by 3-6 inch Digital Verniers on sale at harbor freight for 10 bucks each.. SPC output… I wonder how hard it would be to interphase with an laptop to make really big letters. I wonder if there is some cheap infra-red (tv remote connection) to get the cables out of the way… Too many ideas… too little time. Time to go to work..