Yeah so I've taken a few c++ classes at college, up to data structures. But just because I know how to write a bs-tree doesn't mean im an EXPERT PROGRAMMER just yet. The most complicated program I've written so far is one that solves the Towers of Hanoi by brute force. I still consider myself a beginner-level programmer.
Does anyone have any tips on how to improve my skill? Like a large one-man project that will teach me how to write & manage larger programs? Whenever I got the book store and look at the programming sections everything is either TEACH YOURSELF JAVA IN 24 HOURS or like START C++ FOR THE MENTALLY RETARDED. Everything is aimed at beginners but I want to move on.
>>1
If you wish to learn more about PHP, there are video tutorials here... watch a couple per day, and he'll tell you of a few tools and examples. Again, good luck
Libraries are built from the ground up on C strings, so even if you work with the C++ string construct, you have to convert them back. Receive input from the user? It's in an array. C++ is polymorphic, but the standard library has not a shred of effort into returning C++ strings based on context. So it's a kludge that could only be "forgotten" by creating new languages like Python and Java, altogether.
The reason I bothered to put the code example is to show how to build up a string, but you end up having to combine C++ and C strings. In some extreme cases you need to use stringbuffer constructs, to pass data around. You'll google a lot just to process a bit of data back and forth, specially if you interact with the Windows API, where you need those pesky LPCTSTR things which are C chars or wchars, instead of C++ based. OS's don't facilitate C++ strings because they're are written in C, even if your code is compiled in C++.
Just sad, really.
Name:
Anonymous2007-05-06 21:24 ID:tY2/Gk1/
>>1
lulz. i've been programming for nearly 25 years and i'm still regard myself a beginner.
there's way too much out there to know it all and be another so-called "expert programmer"...
Name:
Anonymous2007-05-06 21:30 ID:/gmFGX53
#include <iostream>
#include <string>
int main() {
char bleh[] = "I'm a string!";
std::string blah(bleh); // char* to std::string
std::cout << bleh << std::endl
<< blah << std::endl
<< blah.c_str() << std::endl; // std::string to char*
return 0;
}
Name:
Anonymous2007-05-06 21:46 ID:3nVRcIU3
>>46
Thanks. That's good for the console, but not when you have to use that input (instead of just cout.)
Say you append to that a string representation of the time and date, and then send that to an "imported" function that stores the whole thing to a file.
I'm just making a point of real life C++ issues. Most of the time your code doesn't deal with the user directly, and it just deals with other code built by the OS or another company. COUT is for simple programs, intro classes or debugging messages. In the real world, if you can't summon a message box, you have to at least leave a log file with such pre-processed information and timestamps. You build lots of custom strings stating what things were running at the time. This is a pretty good thread. Thanks OP!
>>50
Real men write their own function to convert numbers to strings.
Simply because sprintf() is way to much for just a number.
Lastly, here's a PROtip:
If you are going to use sprintf() and the such, to prevent buffer overflows and shit either write a formatted strlen() function (eg size_t strlenf(char *format, ...)) or use malloc and realloc.
Name:
Anonymous2007-05-07 9:15 ID:O1oc4tBf
>>54
if your strlenf is so great why isn't it included in my stdlib?
>>57
then you're a fucking idiot, it's like saying
"well my stdlib doesn't have a regex function so what's so great about regex ?
TRE is a PoS and nobody needs it, ever!"
Or even
"well why is there a printf() ? what is this faggotry who needs printf? I'm happy with my kernel calls"
Name:
Anonymous2007-05-07 12:03 ID:pe+Zlgx5
>>51 was misunderstood by >>52 and >>53. C99 doesn't include asprintf --the latter's one of those orphan / non-standard functions compilers include for convenience. >>54 well, using malloc, realloc and free gets back to my point of C strings being written as a high maintenance hell on earth, since you'll at least double the number of string management lines in your code. Writing my own functions might lead to more bugs but it's for brevity, I guess. However, snprintf() IS standard and it already returns the length of the string formatted (minus the null.)
The functions asprintf() and vasprintf() first appeared in the GNU C
library. These were implemented by Peter Wemm <peter@FreeBSD.org>; in
FreeBSD 2.2, but were later replaced with a different implementation from
Todd C. Miller <Todd.Miller@courtesan.com>; for OpenBSD 2.3.
Name:
Anonymous2007-05-07 23:56 ID:Y0UmH5bV
you might also want to think about running a linux server for something (asterisk, mythtv, web server etc), you'll learn a lot more about how computers and operating systems work in unix than you will in windows.
Name:
Anonymous2007-05-08 0:54 ID:C7c1jN36
>>62 Yup. There's some money in learning (open source) asterisk, I hear from our telephony guy. I'm not sure what hardware you need, since IP telephony would need IP phones, or some kind of ethernet to plain old phone conversion somewhere.
There's a live MythTV CD around. I own a copy, but I think it failed to boot my only computer (a laptop, so it's reasonable and it lacks the Video Decoder needed for what I hear MythTV does.) Web servers, though, in themselves I find a bit overrated. They pretty much run themselves, while you spend the real money on the developers who upgrade your web applications and such. Matter of fact, in the US, I know civil servants who do less in their daytime college web administration tasks daily than you'd do in the bathroom lacking toilet paper. When they're not fixing Oracle or the linux mailer services, they update the schema for the school's hardware or class databases. Students have a selection interface through PHP that they work on. So they keep the server up, but the real work goes in the webpage upgrades / student notices.
Name:
Anonymous2007-05-08 1:17 ID:i5wcX6ln
>>1
if you don't want to be like >>36 ("switch from DOS C++ into real world C++ with QT, MFC or whatever, so that you can get hired", "I myself am trying to learn the win32 API, but it really sucks. That would be too advanced."), buy a book about unix, install unix os on your system (linux would be a great choice), and try to mess with it.
>>64 (>>36 here) Getting linux doesn't have to be a computer-wipe away. If you don't want to repartition, you can use a Live-CD. Ubuntu, Mandriva, Knoppix and other flavors (http://distrowatch.com's sidebar on the right has 100 links to download ISO's) have "boot-from-CD and leave hard drive alone" technology. Matter of fact, you can't save things unless you have a USB memory stick handy, for, say, saving code you wrote while under the live boot. >>65 Thanks. I swear I learned this somewhere, and it wasn't for virtual function initialization --it was someone's C code.
Name:
Anonymous2007-05-10 12:10 ID:SYoyIvaC
>>65 >>69
Pleas elaborate.
The "If the first element in an aray of T is nonzero the rest of the array is initialized." is bullshit.
Name:
Anonymous2007-05-10 21:10 ID:texCOCpz
>>70 >>69 here. It may be one of those conditions where it's up to the implementor to decide. Seems sound to me, in the context it was mentioned. I'm starting to have suspicions, but there was assembly code and I don't care enough to test it myself.
I just know that in the dozens of lines that say something like char name[255] = new char[255], I once saw {0} instead, recently. I probably also saw it in a NES emulator with a struct initialization, but it could just be a false memory.
GCC initializes all fields to zero if you use {0}. I have no idea about nonzero though.
Name:
Anonymous2007-05-11 0:07 ID:fLldn5g+
>>72 Thanks. This thread has turned obscure. I wonder if the original poster is still reading this, as it's been two weeks. I only noticed the thread this past weekend, and have been on /prog/ very often for help, learning and "master programmer" comments. Been fun.