6,741 Posted Topics
Re: >What about the second '\n'? It doesn't exist. That loop is designed for line-oriented interactive input from stdin. Because a newline is expected to terminate the buffering mechanism for your shell, there will only ever be one newline, and that newline will mark the end of the buffer. As such, … | |
Re: At the risk of driving the thread even further off course, I'd like to address some of the issues raised concerning the moderators. >For the very first post I made, a moderator insulted me by saying this is a "professional" >forum and that I should capitalize sentences and use proper … | |
Re: First, stop abbreviating like that. It's unconventional and will easily confuse people. Second, how in the world do you expect us to know what you're talking about when you don't even define your acronym? XDE isn't a common an unambiguous one to the best of my knowledge. :icon_rolleyes: | |
Re: >could this then prove the non existence of god? It's logically impossible to prove that something [B]doesn't[/B] exist for any reasonably complex system, and the universe is somewhat complex. | |
Re: I don't write games, so I can't help. But I do have a question. If you're a web designer, why would your company ask you to help write a game application? | |
Re: >As in selecting which line to start from.? Sure, but unless the file is structured enough to seek, you'll have to actually read your way to the correct line. Writing is harder if you mean to insert rather than overwrite. In that case you need to save the subsequent lines … | |
Re: >Note: Don't use a try catch Erm, why? On Error is generally considered to be a huge wart of VB, so why would you want to avoid the superior equivalent in C# and try to emulate it? | |
Re: Moved. >able to handle adobe photoshop and not slow down when u do other things Photoshop is a resource hog. Keep that in mind. If you're going to be running Vista and Photoshop, I'd recommend at least 2GB of RAM. >Have a webcam and burn cds with lightscribe... You can … | |
Re: We have an active forum devoted to C. I'd wager that one or two of us know it. Can you be more specific about "how C can be made"? Do you mean how to compile C source? How to write a compiler? | |
Re: Insertion sort is easy to write and works well with a stream of items. | |
Re: While I'm pleased that you diligently use code tags, please keep in mind that "icode" and "code" are two different tags that aren't designed for the same purpose. "code" tags should be used for blocks of code that are separate from the text of a post. [code] Code tags are … | |
Re: How about you describe what you're trying to do? What you're asking for is somewhat nonsensical out of context. | |
Re: The text box control only recognizes the system newline, not the language newline, which could be different. Typically '\n' isn't actually multiple characters if the system uses something like CRLF. Instead, whenever '\n' is sent back to the system (through file I/O for example), it's expanded into CRLF. Jx_Man gave … | |
| |
Re: >And what if string.h is not allowed to be used !!!! Most of the functions in string.h are simple to implement. If you can't use the standard library, it's not a great effort to roll your own string handling functions. | |
Re: >iostream or iostream.h??? iostream. iostream.h isn't a valid C++ header anymore. >it's like I'm not using a C++ compiler Maybe you aren't. The file extension usually tells your compiler what language specification to use. If the file is a .c file then you're probably compiling as C, if it's a … | |
Re: >wanted to know if it could be done If you find yourself asking if "<insert something here> can be done in C++", just go ahead and assume the answer is yes. It probably is. >Could you please show me how this could be achieved thanks. How about I tell you … | |
Re: Are you linking with a library file or DLL as well, or just including the header? | |
![]() | Re: My my, such an easy game. >1. replyfast-c++ Gimme code. >2. how do I? Gimme solutions. >3. Help on java Gimme code. >4. java game code Gimme code. >What I am trying to say here is can't people >read the forum guidelines before posting. No. They don't care, so why … ![]() |
Re: When you make a conversion like that, you get the digits in reverse. There are a number of ways to swap the order. First you have recursion: [code=cplusplus] #include <iostream> #include <ostream> void to_octal ( std::ostream& out, int value, int n = 0 ) { if ( value == 0 … | |
Re: PFO is strictly for programming while Daniweb is geared more toward general IT. | |
Re: >So, store the username and password in a file (encrypted I hope), >and on startup, if the file exists, load up the information. Ugh, no. Even encrypted, don't copy the password anywhere, period. Ideally you wouldn't even store it for authentication, instead favoring an irreversible hash[1]. The only place a … | |
Re: >How do I prevent the user from entering characters when a float is required? There's no standard way to stop a user from entering a character. You'd have to use a non-portable solution or allow anything under the sun and provide robust validation. I always recommend going for the portable … | |
Re: >which one is best DLL/SLL Neither, it depends on your needs. | |
Re: >What the heck is going on?! Some of us change avatars regularly. It's an easy way to personalize your posts. | |
Re: >Would I attach pragma once here as well? I don't see why you would need to unless you actually include register.cpp in another file. Otherwise, it'll work without the #pragma because implementation files must only have one instance in the translation unit or you'll get multiple definition errors. #pragma once … | |
Re: Note that there's a point at which it's a bad idea to change your name. When joey did it recently, it threw all of us off, and I'm still not used to calling him John A. :icon_rolleyes: | |
Re: >if the constructor of ClassTest throw exception, what will happen? Why don't you try it and see? >will ptr == 0 ? That's a good assumption. >some memory leak? It depends on what throws the exception and how you deal with it. If your constructor allocates memory but doesn't release … | |
Re: Generating random numbers is a common question here. Try searching the forum. | |
Re: That's...random. I suppose you're using your first post to show off your m4d pr0gr4mm1ing sk1llz. :icon_rolleyes: | |
Re: >I learn what I need to know from the people around me. How is that any different? You're still learning things as another person or persons choose to present them to you. You might feel morally superior, but the end result is likely going to be the same. If you … | |
Re: Template tip #1: Write your class first using concrete types (such as int) and get it working. Then add the template parameters and replace instances of the concrete types with the parameters. This skips the whole "a template isn't instantiated until you use it" crap, which tends to hide simple … | |
Re: >while ((score = sr.ReadLine()) != null) ReadLine returns a string, not a double. There's no implicit conversion from string to double, so you have to make the conversion manually: [code=csharp] string line; while ( ( line = sr.ReadLine() ) != null ) { double score = double.Parse ( line ); … | |
Re: >How can I use templates with generic data nodes? Store polymorphic objects or pointers to void. | |
Re: The location of the executable isn't required to be in the current working directory. What OS and compiler are you using? | |
Re: The simplest method is to break when randomNumber is one of those values: [code=cplusplus] if ( randomNumber == 5 ) break; [/code] That gets a little tedious when the list of numbers to break on is long, but you can easily scale it up with a collection: [code=cplusplus] #include <cstdlib> … | |
Re: What kind of manipulation are you looking for? Standard C++ pretty much only gives you query capabilities for the clock, though you have comprehensive time and date control. | |
Re: The majority of posters aren't interested in being a part of the community. They have a question and bail as soon as it's answered or as soon as it's clear they won't get a "satisfactory" answer. | |
Re: >Shoot the Iraqis carrying Evian bottles because [Evian] is manufactured in France. Haha. >Wait until evening prayers, then bomb the mosque. Bwahaha! I got 11 out of 19, probably because I focused too much on preserving potentially innocent lives. :icon_rolleyes: | |
Re: >"<img.*src\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1\\S+))" but it doesnt work Erm, why not just this? [code=csharp] private HasAttribute ( string src, string tag, string attribute ) { string query = "<" + tag + ".+" + attribute + ".+>"; //... } [/code] All you're doing is checking a specific tag to see if it has … | |
Re: Finding examples of the regular expression library in C# is easy, so I'll leave that to you. The regular expression you want might be something like this: [code=csharp] ">\s*\d+\s*<" [/code] What this does is look for any number with one or more digits (+\d), surrounded by > on the left … | |
Re: If you know the string is big enough to hold all of the extra characters, it's a relatively simple matter of finding instances of "LTD", shifting everything after the matched substring (to make room), and copying the new substring in: [code=c] #include <stdio.h> #include <string.h> int main ( void ) … | |
Re: >Should the implementation be based on front and >rear and just change the value of front and rear. Yes. When you add an item (stack as the example), add to the rear and increment it. If incrementing it would put it beyond the last element, reset it to 0. When … | |
Re: FYI: It's somewhat difficult to pinpoint syntax errors when we can't see the code. So post the code. | |
Re: God, does your ego really need so much stroking that you would lie to keep your bogus Wikipedia article alive? | |
Re: >Is there somewhat better way to type the code below? Are you simply asking for advice on working code, or are you having problems with it? I can see areas where mixing and matching types (both ranges and signedness) may get you in trouble. If all you want is ways … | |
Re: >The method has to be declared using a template. Why? What does this method do? Can you post your code? | |
Re: What have you tried so far? Have you worked out the tasks that need to be performed? | |
Re: >why do programmers benifit from having such a variety? They can choose the data type that best fits the problem and optimize speed or storage costs. >Also if anyone could help me out with what an unsigned character is used for? Off the top of my head: If you don't … |
The End.