921 Posted Topics

Member Avatar for sunderthomas

If you have to implement your own algorithm to do this, try taking a look at a snippet I made some time ago. [B][URL="http://www.daniweb.com/code/snippet1068.html"]Link[/URL][/B] But otherwise, this is an easy problem, you could even try [ICODE]std::stringstream[/ICODE]. You practically don't have to do anything :icon_lol: [CODE=CPLUSPLUS]#include <iostream> #include <sstream> #include <string> …

Member Avatar for monkey_king
0
164
Member Avatar for Mossiah

Creating your own [B]strcat[/B] is nothing, it takes literally a couple of lines.[CODE=CPLUSPLUS]void my_strcat(char *dest, char *source) { // Find null-terminator while ( *++dest ); // Add new string while ( *dest++ = *source++ ); }[/CODE]Making it safe would be the next problem. But think about what [B]Lerner[/B] is telling …

Member Avatar for William Hemsworth
0
74
Member Avatar for The Dude
Member Avatar for Norbert X
0
161
Member Avatar for aarti_gehani

>plz help its urgent... Not for us. >i actually want to read the raw file(CR2 file) of jpeg image using turbo C... You shouldn't be using Turbo C in the first place, you should get yourself a decent compiler. You may be able to read the jpeg file using windows …

Member Avatar for Ancient Dragon
0
124
Member Avatar for shasha821110

Just write your own loop to copy chars without the null-terminator? However, on this line:[CODE]m_length = [COLOR="Red"][B]strlen[/B][/COLOR](m_buffer) + [COLOR="Red"][B]strlen[/B][/COLOR](other) + 1;[/CODE]You are using a function which relies on the null-terminator at the end of the string, so you will have to keep track of the string length yourself while adding …

Member Avatar for William Hemsworth
0
254
Member Avatar for ProgrammersTalk
Member Avatar for GrimJack
Member Avatar for ox99racer

In future, post using code-tags, show what errors you're having, and give more detail to your problem. Just to get some sort of idea on indentation, I've formatted the code for you.[CODE=CPLUSPLUS]#include <iostream> #include <fstream> using namespace std; void namefile(ifstream & infile); void openfile(ifstream & infile); void displayScores(int scores); void …

Member Avatar for tux4life
0
110
Member Avatar for abby2589
Member Avatar for Ahmed_I
0
123
Member Avatar for The Dude
Member Avatar for FTProtocol

> The problem is -- how will you know which one is the browser? Simple :) You can use Spy++ to find out the browsers class name and then you can narrow down which windows are browsers. I found out these: [CODE] Firefox's Class: MozillaUIWindowClass IExplorer Class: IEFrame [/CODE] Now …

Member Avatar for fskreuz
0
1K
Member Avatar for rmlopes

Why are you using the preprocessor for this? This compiles and works for me:[CODE=CPLUSPLUS]#include <iostream> using namespace std; struct A1 { static const int _AINT = 0; }; struct A2 { static const int _AINT = 1; }; template< class T > struct B{ void Fun(){ if ( T::_AINT == …

Member Avatar for siddhant3s
0
212
Member Avatar for ronizam

>i try this program, but something wrong with the loop function. How unfortunate... you may get more help if you post what you've done up to this point.

Member Avatar for Dewey1040
0
118
Member Avatar for bradbobak

Would you mind posting some more code? It can only make it easier to understand what's causing the problem.

Member Avatar for William Hemsworth
0
62
Member Avatar for chriscross86

In future, remember to use [URL="http://www.daniweb.com/forums/announcement8-3.html"]code tags[/URL]. Here is the code how I would have formatted it, after cleaning it up a little for you.[CODE=CPLUSPLUS]#include <stdio.h> int main() { int x; printf("Enter an integer:\n"); scanf("%d", &x); if ( !((x <= 20) && (x > 0)) ) { printf("\nYou have entered …

Member Avatar for Dewey1040
0
102
Member Avatar for jamescolin

I've had it before, but ever since I formatted my pc, the problem seems to have gone. I've always used firefox.

Member Avatar for jbennet
0
342
Member Avatar for William Hemsworth

I came across a small bug recently when clicking on a link to a user profile. It seems that no matter what name you click on, it will only ever link you to the member who last posted in that thread. In my screenshots, I clicked on the link to …

Member Avatar for Comatose
0
378
Member Avatar for Comatose

I remember having that problem, I accidently set the snippet programming language to [B]CPP[/B] instead of [B]CPLUSPLUS[/B] which showed up in its own catagory. Seems to have been fixed now, but it would have been nice to be able to edit that at the time :-/

Member Avatar for William Hemsworth
0
141
Member Avatar for shasha821110

Hmm, an example of a memory leak.[CODE=CPLUSPLUS]int main() { int **a = new int*[10]; for (int i = 0; i < 10; ++i) a[i] = new int[5]; /* Do stuff with a */ for (int i = 0; i < 10; ++i) delete[] a[i]; }[/CODE]In this example, you freed the …

Member Avatar for William Hemsworth
0
111
Member Avatar for pedza95

If your new to C++, you should start on something much easier. I don't even know how to do this, but I can guess it involves some pretty complex stuff, so I don't think you're going to get this done unless someone literally gives you the entire code.

Member Avatar for MosaicFuneral
0
1K
Member Avatar for Icebone1000

Isn't there a checkbox on that dialog somewhere that says "Do not show this warning again", or something along those lines? If it's there, try pressing it :icon_confused:

Member Avatar for Icebone1000
0
172
Member Avatar for GadiK

The problem is easy to solve, instead of adding a new line to the text box, simply add the line to a global string, then assign the string to the textbox.[CODE=CPLUSPLUS]#include <windows.h> #include <iostream> HWND hEdit; // Text Box std::string log; void AddLogLine(char *line) { log += line; log += …

Member Avatar for GadiK
0
1K
Member Avatar for The Dude
Member Avatar for pspwxp fan
Member Avatar for William Hemsworth
0
193
Member Avatar for h3llpunk

Either change the style of the window, or add this to your windows procedure:[CODE=CPLUSPLUS]case WM_GETMINMAXINFO: { MINMAXINFO *mmi = (MINMAXINFO*) lParam; mmi->ptMinTrackSize.x = mmi->ptMaxTrackSize.x = 500; // Width mmi->ptMinTrackSize.y = mmi->ptMaxTrackSize.y = 500; // Height } break;[/CODE]Hope this helps.

Member Avatar for h3llpunk
0
94
Member Avatar for Gaytri Khanna

[URL="http://www.daniweb.com/forums/thread174301.html"]http://www.daniweb.com/forums/thread174301.html[/URL]

Member Avatar for Salem
0
82
Member Avatar for Gaytri Khanna

>what is advantages of main() function. Without it, there wouldn't be a program. [URL="http://wwwx.cs.unc.edu/~sparkst/howto/cpp_main.php"]http://wwwx.cs.unc.edu/~sparkst/howto/cpp_main.php[/URL]

Member Avatar for BevoX
0
206
Member Avatar for Kraizy

I really don't see why this has to be so hard. Just loop through each character, find the start and end of each word, then increment the word count. I guess this is the general idea of what you want:[CODE=CPLUSPLUS]int wordCount(char *text) { int count = 0; for (int i …

Member Avatar for axyelp
0
180
Member Avatar for kishore84

This question has been asked many times. There's a few ways to do this, an easy way is to simply fill up the array with unique integers, then shuffle it like this:[CODE=CPLUSPLUS]#include <stdio.h> int main() { int arr[10]; int i; for (i = 0; i < 10; ++i) arr[i] = …

Member Avatar for William Hemsworth
0
2K
Member Avatar for Abuzer755

Or, if you're willing to spend a little, it's definitely worth buying yourself a decent book on C++. [URL="http://www.daniweb.com/forums/thread70096.html"]See this thread[/URL].

Member Avatar for William Hemsworth
0
138
Member Avatar for Phil++

[B]mouse_event[/B] is used to emulate mouse events, not to detect them. If you want to be able to detect mouse clicks anywhere (even if your window doesn't have focus), you will have to use something like windows hooks. If your using the Windows API and just want to be able …

Member Avatar for death_oclock
0
514
Member Avatar for shila13
Member Avatar for iamthwee
0
98
Member Avatar for sid78669

If you're using windows, here's a pretty straightforward solution to retrieving the console buffer size.[CODE=CPLUSPLUS]#include <windows.h> #include <iostream> int main() { CONSOLE_SCREEN_BUFFER_INFO csbi; int ret = GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &csbi ); if ( ret ) { std::cout << "Console Buffer Width: " << csbi.dwSize.X << std::endl; std::cout << "Console …

Member Avatar for sid78669
0
158
Member Avatar for Zetlin

... music is my life :* ^ Is new to daniweb < Wants to go iceskating... v Is hungry? :)

Member Avatar for ahihihi...
0
85
Member Avatar for Mushy-pea

>Some people might remember [B]Might[/B] remember?! you got me hooked on those games for weeks :icon_eek: And, a nice story :icon_surprised: Took a while to read though.

Member Avatar for ahihihi...
0
118
Member Avatar for simonrangus
Member Avatar for The Dude
Member Avatar for GrimJack
Member Avatar for Nick Evan
0
123
Member Avatar for taichou

Please use [URL="http://www.daniweb.com/forums/announcement8-3.html"]code-tags[/URL].

Member Avatar for geemicah
0
133
Member Avatar for AdRock

To make things simpler, you can read the data in as a 1D array (pointer), but still be able to access the data through a 2D array. Like this:[CODE=CPLUSPLUS]#include <iostream> #include <fstream> #include <string> using namespace std; int main() { //number of rows and cols string words[4][4]; // Pointer to …

Member Avatar for AdRock
0
180
Member Avatar for tomtetlaw

Could that question be any more vague? You're going to have to post much more detail before you can expect a reply of any help.

Member Avatar for tomtetlaw
0
132
Member Avatar for Teethous

Hey David A. Newbie, use [URL="http://www.daniweb.com/forums/announcement8-3.html"]code-tags[/URL] in future.

Member Avatar for Comatose
0
108
Member Avatar for clutchkiller

I use VS2005, and I prefer it out of all the compilers that I've use in the past.

Member Avatar for TheBeast32
0
134
Member Avatar for Mighty

It's an easy problem, just remember to split it up into parts. >The program should ask the user how much the pallet weights by itself First, make a program.[CODE=CPLUSPLUS]#include <iostream> int main() { }[/CODE] Now, allow the user to input the weight of the pallet.[CODE=CPLUSPLUS]#include <iostream> int main() { float …

Member Avatar for Mighty
0
352
Member Avatar for clutchkiller

A portable way to retrieve the file size :icon_razz: [CODE=CPLUSPLUS]// Returns number of bytes in a file int GetFileSize(char *file) { // Open file std::ifstream f(file, std::ios_base::binary | std::ios_base::in); // Make sure it's opened correctly if ( !f.good() || f.eof() || !f.is_open() ) { return 0; } // Beginning of …

Member Avatar for William Hemsworth
0
91
Member Avatar for 3pid

>I have already write something! If you have some code, then post it so we can help.

Member Avatar for William Hemsworth
0
102
Member Avatar for The Dude

I think the author goes a little far with the '[B]beating your kids[/B]' part, but as Ancient Dragon said, a spank isn't too bad. Even though I obviously don't have kids yet... sometimes I think it's just the best solution to showing them that you're serious :icon_rolleyes: Especially after watching …

Member Avatar for William Hemsworth
0
63
Member Avatar for meabed

[QUOTE=Narue;506452]>The most efficient way for swapping whole numbers is <snip xor swap> >because xor is an assembly level instruction and its much faster than any move operation. An empirical test disproves your claim. The swap using a temporary is noticeably faster on at least one compiler (Microsoft C++) given any …

Member Avatar for Lisa1110
3
1K
Member Avatar for sai56

In VS2005, right-click on the toolbox, click on the menu item 'Choose Items', go to the tab 'COM Components', and check the 'Windows Media Player' check box. You can then drag that control into your form application. You will need to use google to figure out how to use this …

Member Avatar for William Hemsworth
0
100
Member Avatar for Dendei

I would probably try and solve this by reading all the data into an array of chars, and then manually splitting up the text. You should have more control over whats happening if you do this. See my [URL="http://www.daniweb.com/code/snippet1068.html"]code snippet[/URL]. As for converting to an [B]int[/B], it's no big task, …

Member Avatar for Dendei
0
231

The End.