Forums » Off-Topic
Yay! It works! I don't know exactly what the "%s" input type is, but it works!
%s = string input, like a multiple of chars, like for instanc ewhat im typing now :D
Aah... So a %c is a %1s? But %1s works and %c doesn't... Whatever! I've rewritten the entire program using returns instead of jumps, btw.
I dont really get it either, I think it adds "/n" and some other crap, you gotta sorta chop it off with %1s. Otherwise it trys to jam all that into a single char, which cant hold all that. I think %1s forces it into a character array and grabs the first char in the array, but I only looked at those low level char i/o fucntions for 20 minutes. I prefer to use wrappers for my strings, std::string i think is linux usable. This kinda stuff is easy for some people, hard for others. I find it hard. I could write a bot that flys around an asteriod in vendetta faster then I could write a tic-tac-toe game using these functions. Its important stuff to know though, so I'll spend more time on it latter. I like how basic handles strings, and escript, which is what I'm used too. C++ is a little brutal with strings.
I just got done testing a function that disbands the callers guild, and its working perfectly. I ended up creating a tempfile to store everything I dont wont to kill, then killing the real file and renameing the temp file. Talking to other programmers tells me this is the norm, but still seems cheesy to me. Anyways, Im in a fairly good mood, and feeling more comfortable with my compiler.
oh yea, the %s thing, the number before the s is length. so if you did like a %2s it would grab 2 characters of user input.
(y/n)
yyyyyyyyyyyyyyy <- me hiting y many times before pressing enter
result with %1s = y
result with %2s= yy
result with %80s would proably have yyyyyyyyyyyyyyy +carrige return + newline char and maybe some chocolate frosteing.
Isn't iostream.h easier to use? cin and cout etc....
I just got done testing a function that disbands the callers guild, and its working perfectly. I ended up creating a tempfile to store everything I dont wont to kill, then killing the real file and renameing the temp file. Talking to other programmers tells me this is the norm, but still seems cheesy to me. Anyways, Im in a fairly good mood, and feeling more comfortable with my compiler.
oh yea, the %s thing, the number before the s is length. so if you did like a %2s it would grab 2 characters of user input.
(y/n)
yyyyyyyyyyyyyyy <- me hiting y many times before pressing enter
result with %1s = y
result with %2s= yy
result with %80s would proably have yyyyyyyyyyyyyyy +carrige return + newline char and maybe some chocolate frosteing.
Isn't iostream.h easier to use? cin and cout etc....
iostream isn't proper C, it's proper C++. This is a C program.
gotcha. std::string is out then :(
I wouldnt learn c, but thats a whole nother issue with oop vrs procedural programming.
I wouldnt learn c, but thats a whole nother issue with oop vrs procedural programming.
I used to do C++ more... But then I realized that I'd used objects, like, once. C I find to be much easier... Especially since this is [eventually] going to be a gtk2 application, which means C only. (Yes, I could use gtkmm. I won't)
I thought you guys might like to see what you've been contributing to.
http://www.roguelazer.com/programming.html
The program is JMaths, the latest version is 0.1.6 (at this time)
http://www.roguelazer.com/programming.html
The program is JMaths, the latest version is 0.1.6 (at this time)