560 Posted Topics
Re: If you are using Windows it's pretty simple, but not exactly guaranteed to not "flash" a console window for a moment. What [b]sfuo[/b] meant is you can tell your compiler to not spawn the console window. It's a compiler switch. Now, this is the "dirty" way... [code] #include <Windows.h> int … | |
Re: 1 : C++ was my first programming language, it takes a while (a long time), heh that "steep learning curve" thing really doesn't mean it gets difficult to understand. But be prepared to put some time into it. 2 : I think it is, but I'm not a game programmer … | |
Re: Depends on what Operating System you are using. For Windows: [url]http://www.microsoft.com/express/Windows/[/url] | |
Re: Where to ask? The proper forum, of course. Advice? Of course. Although you don't seem like the type, don't ask us to write code for you. Meaning, you have to show some effort to get help. Post the code you have, and tell us what you're having problems with. As … | |
Re: [url]http://msdn.microsoft.com/en-us/library/bb525388(v=vs.85).aspx[/url] Try testing the return value. There is also an example on that page. | |
Re: I'm not sure I agree with finding code on the internet and trying to use it. The way for you to understand it is to write your own code. If you run into problems while trying to do your own homework, please let us know and we'll kindly try to … | |
[url]http://www.boost.org/doc/libs/1_46_0/libs/smart_ptr/shared_ptr.htm#ThreadSafety[/url] This section somewhat confused me, in my code I have a matrix of shared_ptr's pointing to an entirely thread-safe class. But the shared_ptr documentation says it is only as thread-safe as the built-in C++ types. Does this mean that if I read/write to my thread-safe class using shared_ptr's at … | |
Re: You will need the debug DLLs for the debug version and the release DLLs for the release version. | |
Re: Reading here may help: [url]http://svn.scipy.org/svn/numpy/trunk/doc/neps/npy-format.txt[/url] | |
Re: What happens when you do: [code] char text[20]; cin >> text; [/code] ?? I really don't know, but I think it will allow someone to enter too many characters and 'sploit the program. [code] const std::streamsize BUFFER_MAX = 1024; char buffer[BUFFER_MAX] = {0}; std::cin.getline(buffer,BUFFER_MAX,'\n'); [/code] | |
Re: I don't think there is a standard way to do this (if I'm wrong I would like to know) so you will probably have to rely on the operating system. If you're using Windows/Linux the exact functions will vary. Windows: [url]http://msdn.microsoft.com/en-us/library/078sfkak(v=vs.80).aspx[/url] | |
Re: I think he needs to know how to dynamically allocate the array... [code] char *buffer = NULL;//<-- good style dictates initializing to nullptr. buffer = new char[1024];//<-- array of 1024 characters. //use array with familiar notation delete [] buffer;//<-- delete the allocated memory so you don't "leak" it. buffer = … | |
Re: Be able to take advantage of every feature of C++, including the STL. Study Algorithms, Data structures, and other misc. Computer Science stuff--like Artficial Intelligence, etc. For instance a DFA/NDFA/FSM comes in REAL handy sometimes: [url]http://en.wikipedia.org/wiki/Finite-state_machine[/url] Calculus too. | |
Re: You could use instead: [url]http://cplusplus.com/reference/clibrary/ctime/time/[/url] | |
Re: I hate to spring this kind of things on you, but if you expect some Americans to look at your code (which I am a native speaker of), you may want to read/write it like us too. | |
| |
Re: [url]http://www.cprogramming.com/[/url] //<-- not too bad. [url]http://www.cplusplus.com/doc/tutorial/[/url] //<-- didn't use it, probably would now. [url]http://www.functionx.com/cpp/[/url] //<-- not the best in my opinion. | |
Re: I think the pages for the functions you're using here will help: [url]http://www.cplusplus.com/reference/stl/list/[/url] | |
Re: In your example: [quote][icode]std::tolower(*end)[/icode][/quote] tolower is in <cctype> and is a C function. | |
Re: You have to attempt it, and if you run into trouble we may offer some help. Basically we don't do your homework for you. I will help you with this at least, if 'n' grows even slightly large you will need a very large data type to store the sum. … | |
Re: I tend to think it would be a problem with reading the file. This will cause problems: [quote][icode]while(!Infile.eof())[/icode][/quote] Try instead: [code] std::string name; unsigned long age; while( inFile >> name >> age ) { //.. use it. } [/code] Otherwise consult some file IO reference material. | |
Re: I'm taking a look at some of the code, my initial thoughts on your first problem are that the file stream has error bits set that need cleared. Firstly as a matter of good style let's initialize your char array to '\0'. [icode]char fname[30] = {'\0'};[/icode] What this code does … | |
Re: Copy everything to a new string and when you hit a '\n' insert "<br>" instead. | |
Re: It looks like you need to know how to do this, but I'm kind of unsure, because it's very simple to do... [code] for(size_t i = DIM1 - 1; i > -1; i--) { for( size_t j = DIM2 - 1; j > -1; j-- ) ;//... } [/code] | |
Re: No you don't need global variables you can pass by reference or pointer, but I would suggest making a variable "static". [url]http://msdn.microsoft.com/en-us/library/s1sb61xd(v=vs.80).aspx[/url] Note that the "static" keyword may behave differently than you expect in classes. ex: [code] int CurrentTotal(int n) { static int total = 0; total += n; return … | |
Re: For the 10 seconds to enter a password thing you will most likely want to start a new thread that waits for 10 seconds to grab some input. | |
Re: I noticed you have a lot of variables in one structure, I usually try to nest some structures like this: [code] struct CategoryOne{ int a; int b; std::string s; }; struct CategoryTwo{ bool tf; double d; }; struct AllMyData{ CategoryOne catOne; CategoryTwo catTwo; }; [/code] I am only posting this … | |
Re: [b]Do not use [quote][icode]void main()[/icode][/quote] use instead [code] int main() [/code] [/b] | |
Re: If you intend to skip whitespaces I suggest you read using operator>> In your original code you have both: [code] getline(inFile,str); //and inFile >> str; [/code] Perhaps re-writing your loop condition to: [code] while(inFile >> str) { } [/code] and the operator '>>' will read in one block of non-whitespace … | |
Re: Any reason for passing by pointer instead of by reference? | |
![]() | Re: Place code between the code tags, which are [ code] and [ /code] (without the space) I would consider using a matrix to represent the seat data, and a structure holding the information for each seat. matrix = 2 dimensional array For the letter-index system, I would simply create an … ![]() |
Re: I agree with jonsca, the string class is managing that memory and implementations vary. [url]http://www.cplusplus.com/reference/clibrary/cstring/strtok/[/url] | |
Re: Are you aware this is making an array of pointers? [icode]Event *events[MAX];[/icode] I think it would be best for you to review the basics of pointers and dynamic memory allocation, you leak memory for the Event you allocated. Some better style may help you detect errors, by initializing the array … | |
Re: Microsoft unicode stuff. [url]http://msdn.microsoft.com/en-us/library/aa272960%28v=vs.60%29.aspx[/url] You will likely opt to use either the "char" type of string, or the "wchar_t" type. Visual Studio provides a std::wstring. [url]http://msdn.microsoft.com/en-us/library/wt3s3k55%28v=vs.71%29.aspx[/url] Note that wstring is a basic_string<> templated to wchar_t. You may also opt to convert the "char" string to "wchar_t". See MultiByteToWideChar: [url]http://msdn.microsoft.com/en-us/library/dd319072[/url] | |
Is there a way to define a property with default get/set functionality for a variable? | |
| |
Re: Unfortunately I don't think it's possible to have two windows in focus at the same time on Windows. I don't think the OS works like that. | |
Re: I'm just wondering, is there a way to compute the arithmetic mean without using a summation like the normal algorithm does? | |
Re: What problems are you having? | |
Re: It can be done but it's usually not easy, nor is it intuitive. I have "scraped" a website with C++, which means downloading a copy of the web page's HTML. For your particular problem, wouldn't ftp be easier to use than HTTP ? Scraping is a bad way to do … | |
Re: [quote][code]bubblesort(array[],size);[/code][/quote] to [icode]bubblesort(array,size);[/icode] | |
Re: I think you're missing some program code, and tell us exactly what problems you are experiencing, and also what you're trying to accomplish. | |
I found this excellent video on one of Microsoft's websites: [url]http://msdn.microsoft.com/en-us/ff728575[/url] I'm really just wondering how to organize the window procedures for my Dialogs/Buttons/etc. Would one normally after creating a dialog throw the window procedure into a new file? I don't like tiny bits of code in different files, so … | |
Re: In win32 it is in either LPARAM or WPARAM, I've forgotten (don't use it)--so, I'll happily google that for you so that we both learn. I'm hoping you can apply this to your MFC application. Ok, MSDN (which you should be using as a reference) says: [url]http://msdn.microsoft.com/en-us/library/ms646276%28v=vs.85%29.aspx[/url] WPARAM is the … | |
Re: I don't think this is correct, I've never seen anyone try to do this, either: [quote] [code] inFile.read((char*)&Value1, sizeof(string)); [/code] [/quote] It just looks like a really bad idea, with the string not being an array of characters and all, what with the functions and what-not in the class. | |
Re: Oh and that loops 201 times, starting at zero and continuing until = 200 = 200 + 0 (0 counts as one also) thus 201. | |
Re: Personally I started programming in C++ while I was in middle school, it was a beast but after a while (i would guess a few weeks) studying at home after school (programming didn't suck like my classes), I was able to put together some decent programming logic with it. The … | |
Re: If your C++ code consists of functions in a header file, then include the header file in the form you wish to use it in, and call the functions. If your C++ code consists of class/es in a header file, then include the header file and use the class. I … | |
Re: I have to stand up for Ivor Horton's Beginning Visual C++ series. The 6.0 version of his book has served me well. The 2010 edition teaches C++/CLI as well as C++. I think he has a title that is pure C++, but you may want to look around for it … |
The End.