Author |
Message |
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Fri Feb 23, 2007 5:05 pm Post subject: Recource files |
|
|
|
|
I can't seem to find a tutorail to use recource file's in c. Url. Or if you're cool enough to answer another one of my beginer's questions, go ahead.
ty.
Reason: For my spanish translator. wanna have a recourse file that is basically a database for all the translations i have. |
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sat Feb 24, 2007 6:09 am Post subject: |
|
|
|
|
What do you think a resource file is? _________________ ss news |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat Feb 24, 2007 11:35 am Post subject: |
|
|
|
|
Probably wrong: A file that i want so that my main.cpp isn't so big. one for verbs, nouns, spanish rules, greetings. All of these i can make functions in and refer to it in main.cpp. that's what i want, probably not right though. |
|
Back to top |
|
|
Bak ?ls -s 0 in
Age:25 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sat Feb 24, 2007 1:18 pm Post subject: |
|
|
|
|
The thing is that resource files are Windows-specific, so using them automatically makes your source code non-portable. Arrays would be the way to go, and they'll probably be easier, too. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sat Feb 24, 2007 2:30 pm Post subject: |
|
|
|
|
If you think about this from a programmer's perspective, you'll see that the English to Spanish translations are not really part of the program. It is a backend database tool that can be independent of the program.
A better way to go about this is to have the words be in a separate file and load that at runtime. Based upon your previous code postings, I'd say that this is a bit beyond you at this time. Have you looked into maybe trying a language with more of a universal library, such as maybe python? Python's language structure is more suited to novices than C is, with a nice extensive library of functions that you can use instead of having to write you own. |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sat Feb 24, 2007 5:24 pm Post subject: |
|
|
|
|
I'm looking into python. This may sound funny, but i'm looking into computer programming as a job so i'm trying to learn c first. (don't worry, i'm still only 14). but as you said:
Quote: | Based upon your previous code postings, I'd say that this is a bit beyond you at this time. Have you looked into maybe trying a language with more of a universal library, such as maybe python? Python's language structure is more suited to novices than C is..... |
which makes sense to learn easier languages and move up, not starting big. kinda like a stick shift, start low go up. ty.
Back to My question:
Quote: | A better way to go about this is to have the words be in a separate file and load that at runtime. |
That's exactly what i wanted to do, but i didn't know if there were special commands required to use a function from another file. (and i obviously thought it was called a recourse file). thanks again.
@MGB: not at all offended by you calling me novice, it's like a genious calling me stupid.
P.S.:I'm going to get a book to refer to tomorrow so i don't have to bug you guys.(and my dad hates computers which is my source for learning code right now) |
|
Back to top |
|
|
Animate Dreams Gotta buy them all! (Consumer whore)
Age:36 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Sun Feb 25, 2007 4:14 am Post subject: |
|
|
|
|
Well, starting at 14 is certainly the way to go. As far as books, I would kind of like to suggest checking out Sam's Teach Yourself C++ In 21 Days. It was pretty easy to read, even with no programming experience. You'll only learn syntax and stuff, and very little of actual programming and problem solving, but it's a good introduction that won't scare you away from programming.
Anyway, in this one particular case, since all he wants is a smaller .cpp file, wouldn't the best solution(in this one case) be to put that stuff in a header file? I mean, sure, MGB's database solution is almost assuredly the best one, but the TC is probably just doing this to learn, and if all he wants is a smaller .cpp file... I don't know, it just seems like someone would've mentioned it by now. Or maybe you guys were just assuming that's where he'd put them?
soccerman, I'm assuming you know about header files, but since you're new, I guess it's possible you don't. In case you don't, you can put code into a file, and you can call it something like verbs.h, and then type #include "verbs.h" in your main.cpp, and it will include all of those definitions in your file. It probably would be better to read in the words from a separate file, but this is a bit harder to manage programming wise than just putting the words in a header file. Besides, you won't be able to read in data from a text file without causing a debate as to whether stdio or iostream was better. |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sun Feb 25, 2007 8:44 am Post subject: |
|
|
|
|
Yeh, i was reading up on headers a little bit. I actually got my program to work just by adding a recourse file to my project and it automatically linked for me(using dev c++). I can learn about manifest files later lol. I'll look into teach yourself book, but does it matter that that is for c++ and i'm learning c? thanks again
Carry on my wayward son!!! best song in the world |
|
Back to top |
|
|
Animate Dreams Gotta buy them all! (Consumer whore)
Age:36 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Sun Feb 25, 2007 3:38 pm Post subject: |
|
|
|
|
Well, they have a Teach Yourself C in 21 Days book as well. I can only hope it's as simple as the C++ book was. The more I learn about programming, the more I realize how much the C++ book left out, but... as long as you treat it as an introduction to the language and to programming syntax, you'll be fine. You should probably get the C one instead, though. If for no other reason, do it so you won't have to learn multiple virtual inheritance right off the bat. I'm assuming they'll teach you something more useful in place of that. I really don't think Inheritance should be taught before you even learn how to program, that's a bit ridiculous. But whatever. I haven't seen the C book, but considering it's the same company I imagine it's very similar to the C++ book, so I suppose I'd recommend the C one instead.
Also, There'll be peace when you are done.
But... why'd you randomly start singing that? I'll be singing it all day.... |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Sun Feb 25, 2007 4:19 pm Post subject: |
|
|
|
|
Already bought it. looks good. i randomly started singing that song because i can. and i like it. |
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Mon Feb 26, 2007 3:38 pm Post subject: |
|
|
|
|
Animate Dreams wrote: | TC is probably just doing this to learn, and if all he wants is a smaller .cpp file... I don't know, it just seems like someone would've mentioned it by now. | I was going to mention it, but forgot to check the forums for a bit.
As for buying books, you can get them for free at libraries, and if they don't have it then it's usually a very small fee for them to get it (I did this with my local library for some Palm OS programming books). You can also find them online, but legally I don't know, plus sometimes reading paper is easier for the eyes than reading a screen. |
|
Back to top |
|
|
tcsoccerman Server Help Squatter
Age:31 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Mon Feb 26, 2007 4:01 pm Post subject: |
|
|
|
|
Quote: | plus sometimes reading paper is easier for the eyes than reading a screen. |
bingo
plus my dad doesn't like me on computers. i already bought a book though at borders so i could keep it and it's just easier. i had 25 dollar gift card from someone so no biggy. |
|
Back to top |
|
|
Animate Dreams Gotta buy them all! (Consumer whore)
Age:36 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Mon Feb 26, 2007 9:25 pm Post subject: |
|
|
|
|
I MUCH prefer reading books on paper. Besides, I spend enough time staring at a screen as it is. And since I refuse to use anything but CRT, it can get to my eyes. Besides, you can let people borrow books, and read them during class. Some of my classes are so pointless because I already know all the material, so I read instead. Which reminds me, I have a Java assignment due in a couple hours. |
|
Back to top |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Tue Feb 27, 2007 10:42 am Post subject: |
|
|
|
|
Animate wrote: | And since I refuse to use anything but CRT, it can get to my eyes. |
This doesn't make any sense... |
|
Back to top |
|
|
D1st0rt Miss Directed Wannabe
Age:36 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Tue Feb 27, 2007 5:36 pm Post subject: |
|
|
|
|
Cathode Ray Tube _________________
|
|
Back to top |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Wed Feb 28, 2007 11:31 am Post subject: |
|
|
|
|
I know what a Cathode Ray Tube is, I just don't understand why he would refuse to use anything but one and then complain about them hurting his eyes.
On another note, I finally got good-looking fonts in Linux! You just need to install Windows fonts, the ones that come with Linux by and large suck.
Windows fonts for Linux |
|
Back to top |
|
|
|