15,300 Posted Topics
Re: There are people all over the planet who apparently think God said "trains" instead of "brans", and told Him "No thanks.". | |
Re: Here is how to cut a section out of a std::string [code] int main() { string str = "Now is the time"; str.erase(4,3); cout << str << "\n"; } [/code] In your code, instead of 4,3 [icode]str.erase(textBox1.SelectionStart,textBox1.SelectionLength); [/icode] [edit]Too late -- already suggested :)[/edit] | |
Re: since the file is in binary mode you can write the matrix in one big swoop instead of one element at a time [icode]mat_file.write(reinterpret_cast<char*>(mp), row_sz * col_sz * sizeof(float));[/icode] With that you can delete that entire loop. And read it back with that same line, except change write to read. | |
Re: The problem appears to be in winbgim.a -- The function cls_OnClose() calls exit(). If you download the source to that library you can change that behavior. But if you do that it may have other unintentional consequences, such as memory leaks. | |
Re: you mean if the user types "Hello World" <Enter key>, you want to add '\n' to the end of the string? | |
Re: This worked for me, using vc++ 2008 Express. But also note that conio.h is non-standard and not supported by all compilers. [code] #include <windows.h> #include <conio.h> #include <stdio.h> int main() { int c; printf("Enter something\n"); while( !_kbhit() ) Sleep(100); while( _kbhit() ) { c = _getch(); printf("%d\n", c); } } … | |
Re: My prediction is that Chrome will not have any impact on IT other than maybe for hobbyists. If it just sits on top of *nix then why bother with it? | |
Re: what compiler are you using? Take the error messages one at a time, then recompile to get a new list. For example, main() is missing declaration of variable [b]i[/b] in a lot of places. The declaration of [b]i[/b] in the first for loop is only valid for that loop. I'd … | |
Re: between lines 15 and 16, just use string's find() method to locate the = symbol and then extract the remainder [code] size_t pos = songTitle.find('='); if( pos != string::npos) { songTitle = songTitle.substr(pos+1); // bypass the = } [/code] This assumes the string is something like this [icode]song title=Hello Dolly[/icode] | |
Re: Of course there is [code] int main(int argc, char* argv[]) { string args; for(int i = 1; i < argc; i++) { args += argv[i]; args += ' '; // add space between args } } [/code] | |
Re: Welcome to DaniWeb and hope you joing in the discussions here. Feel free to browse all the forums and get acquainted. | |
Re: It seems the problem is fscanf() -- it will only read up until the first white space( spaces, tabs, ets ). If you need the entire line then use fgets() to read the line and then parse it -- call strchr() to find the colon then extract the rest. | |
Re: might be useful to provide a link that explains that function so that people here know what you are asking. Also state the operating system and compiler. | |
Re: search [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS328&=&q=how+to+monitor+data+between+usb+and+device&btnG=Google+Search&aq=f&oq="]these links[/URL] Some of them are very expensive -- $3,000+USD | |
Re: Microsoft compilers no longer supports generating makefiles. Instead, it has a command-line tool to use the solution file. [URL="http://msdn.microsoft.com/en-us/library/f35ctcxw.aspx"]See this article[/URL]. | |
When a post is flagged is it possible to disable that link so that others know it has already been reported ? Currently there is no way for members to know if a post has been reported or not, so we wind up with several people reporting them. | |
Re: Since you didn't say what operating system or version you are using, my guess was to move it here. | |
Re: If you want the C method [code] char iobuf[255]; long ints[255] = {0}; int i = 0; // get each line of the file while( fgets(iobuf, sizeof(iobuf), fptr) != NULL) { ints[i] = atol(iobuf); } [/code] | |
Re: >>There's no place like home! I think that's true of most people around the globe. As for the 4th, I'm working at Wal-Mart today, one of the busiest days of the year. Yesterday was non-stop shopping from the time I went to work at 9:00 a.m. until long after I … | |
Re: Each has its own purpose: [icode]MyClass A;[/icode] will disappear from view then the function exits (unless its global), and you can not specify the type of object, whether it is grandfather of class B or class C. The only way to do that is to use a pointer. [code] class … | |
Re: Cets are not the primary thing employers look for, but they may make a difference in distinguishing you from the other guys with the same education and experience. | |
Re: inheritence means something like this: Class B can call the function from class A because class B inherited everything from class A. [code] class A { void SayHello() { cout << "Hello from class A\n"; } }; class B : public A { public: B() { SayHello(); } } [/code] | |
Re: [QUOTE=Himani_29;912521] does sum1 make a solution for it..??? i m wrkin on DevC++[/QUOTE] No. We do not write your program for you, but we will help you write it yourself. Show us some effort, such as post the code you have tried, and ask specific questions about your code. But … | |
Re: If the military time is past 12:59 then just subtract 12. For example: 1300 - 1200 = 1:00 p.m. | |
Re: Why would you want to use such an old compiler? Get the newest version VC++ 2008 -- [URL="http://www.microsoft.com/express/vc/"]the Express edition is free.[/URL], but it has its limitations, such as no support for MFC. | |
Re: Example: "g++ -o out.a main.cpp" If you want that to be executed inside a C or C++ program: [icode]system("g++ -o out.a main.cpp");[/icode] | |
Re: without buying $$$ some expensive profiling programs, that would be about the simplest way to do it. | |
Re: [URL="http://lmgtfy.com/?q=odbc+c+tutorial"]tutorials[/URL] | |
Re: shadwickman is right -- we are not here to write programs for people but to help them write their own programs. You will not learn anything if all you do is copy someone else's work. The first thing you need to do is sit down with pencil & paper and … | |
Re: move lines 20, 21 and 22 up between lines 17 and 18 (outside the loop) | |
| |
Re: use a loop and validate user input [code] while(true) { cout << "Enter a number\n"; cin >> number; if( !cin.good() ) { cin.clear(); cin.ignore(1000,'\n'); cout << "Error\n"; } else break; } [/code] | |
Re: >>cout<<sizeof(b)<<endl; The sizeof operator (its not a function!) returns the number of bytes occupied by the object. In the case of variable [b]b[/b] it is 6 integers and the size of one integer is 4 bytes, so simple math 6 * 4 = 24. The second one is a little … | |
Re: A [URL="http://msdn.microsoft.com/en-us/library/ms997537.aspx"]Windows Hook [/URL]might do it. | |
Re: It will probably depend on your education level -- are you college freshman or going for a Ph.D.? The difficulty of any project will depend on that. Is this for a computer language course (which one) or something else? | |
Re: Looks like its missing a close bracket } at the last line. What other compiler errors are you getting? What compiler and operating system are you using? | |
Re: I was a coder for over 20 years and know no one who smoked marijuana. Tobacco yes, marijuana no. And it makes sense to me -- can't program when stoned or intoxicated. | |
Re: I assume you mean clock() -- yes, just restart the program. | |
Re: put an else between the first two if statements, like you did between the last two statements. | |
Re: >>Visual Studio 2008, which I assume is a 64 bit compiler. No -- its a 32-bit compiler. But the Pro version can compile 64-bit code if you provide the right options. Just because you compile something on a 64-bit os doesn't mean you will automatically get a 64-bit program. Post … | |
Are you going to pre-order Windows 7? I have and got the Pro edition because it contains XP compatibility mode. | |
Re: 2) The computer speed has nothing to do with srand(). srand() is used to see the random number generator so that it does not generate the same set of random numbers every time you run the program. 4) We are only a little peeved at newbies who want us to … | |
Re: What more information could there possibly be??? As you already stated its just a pointer to the current c++ class object. For example, here's the output of the following in c++. It shows that the this pointer is the same in both child and parent. [code] A: this = 2afc38 … | |
This is not very far from where I live -- 170 ft water tower built in 1949 and restored in 1995. [url]http://www.catsupbottle.com/[/url] | |
Re: As a user I almost never use site maps, I have never found a use for them. | |
| |
Re: There is no point comparing the difference because such a comparison will be compiler dependent. How one compiler implements cout and printf might be different than how some other compiler implements them. One compiler might wrap cout with printf() while another compiler might wrap cout with win32 api function WriteFile() … |
The End.