|
|
|
const int arraySize = 5;
double values[arraySize];
values[0] = 23.4;
for (x = 0; x < arraySize; x++)
values [x+1] = values[x] * .10; Plug in x = 4 in the loop and you get:
values[5] = values[4] * .10; You're writing off the end of the array when you assign to values[5] .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
that's right, sorry
Jon
|
|
|
|
|
I know its possible in C# using web resource provider but please tell me how to do it using VC++ .Is there any MFC available ???? i also want to login into that website using id and password. please reply
|
|
|
|
|
micku wrote: Is there any MFC available ????
Yes. Here's the MFC equivalent[^] of WebResourceProvider. You will likely want to pass the user id and password as post arguments.
/ravi
|
|
|
|
|
I have a toolbar and a statusbar on my main window, which I would like the user to be able to show or hide. Easy enough I know, but the problem is I have many controls on the dialog which would need to move as a result. I have coded it in a way that when ever a WM_SIZE message is processed, it calculates the rect for the toolbar and status bar. Calling the ShowWindow() function, does hide the controls, but GetClientRect() still return with the size. Is there a way around this? Non MFC by the way.
|
|
|
|
|
Can't you use SetWindowLong to show and hide one control?
you may need to use to the style using GetWindowLong function.
-- modified at 9:22 Sunday 20th August, 2006
|
|
|
|
|
Thanks for the suggestion. I used the SetWindowLong() function to disable the autosize feature of the toolbar, then resized it to 0, all seems to work, until I want to restore it. I reset the Styles, reset the size, and call for an update. The toolbar appears, minus the buttons??? I thought this would be a simple task so I left6 it till the last, guess I was wrong!
|
|
|
|
|
Currently i have a structure of
struct data
{
long int addNumber,addPostal,exMth,exYear;
char fName[40],lsName[40],addStreet[40],addCity[40],addState[40];
};
data dataRecords[100];
This is used to store values in dataRecords[0],dataRecords[1], etc...
In using this method, I can only store up to a max of 0-100 records. Is there anyway where number of dataRecords can be made dynamic? instead of limiting it to 100. There is another method of using linked list instead, but i dun have enuff time to change my whole program to adapt to it.
Thanks
|
|
|
|
|
The best way to deal with dynamic arrays is using the vector class from the standard template library.
Another way is yo use dynamic arrays (by using new[] and delete[]) but then you have to manage the memory yourself.
|
|
|
|
|
Using the STL vector class is probably the best way to go. And while you're at it you may save a bit of space using the STL string class too.
|
|
|
|
|
|
Hello everyone,
I always notice that some guys are using some VC built-in variables to specify some properties, like OutDir, ProjectName, SolutionName, etc. Then we can use the built-in variables to specify, for example, the generated library name, like $(OutDir)/$(ProjectName).lib.
I think this way is very convenient compared with hardcoded names. I am wondering where can I find a list of all such built-in variable names and meanings?
thanks in advance,
George
|
|
|
|
|
In VS.NET 2003, go to Project Properties, Build Events, Post-Build Event, click in the Command Line box, then click the [...] button that appears at the end of the field. Then click the [Macros>>] button to expand this dialog. This lists all the macros valid for use in this project.
|
|
|
|
|
Cool way, Mike!
I could also see the values as well.
regards,
George
|
|
|
|
|
Using Visual C++ 6 in Visual Studio 6
I need a c++ function to find particular patterns in single word strings and remove them from the string. These patterns are either always at the right of the string or at the left of the string, never in the middle. I have over 300,000 patterns to search for, currently stored in an Excel table. An example is as follows:
I give the function “recyclable” and the pattern “able” is removed, thus returning “recycl”. The spelling error is irrelevant. If you take another example, “recycling” and the function removes “ing” thus again returning “recycl” you can see where I am coming from. Both words, “recyclable” and “recycling” return the same result. This is what I want.
As I said, I have over 300,000 of these patterns that need to be searched for and removed. All values have been converted to lower case.
Here is an example of how I am currently doing this in Filemaker Pro, in plain English using the word “photographer”
I feed the word “photographer” to the variable X. “er” exists as a right value in my table, and because X is longer than 2, “er” is removed. The length needs to always be bigger than the table value, or X might be set to empty. If you consider that my table contains the right values “er” “ic” “y” etc. than you will see that the following results can be obtained:
photographer = photograph
photography = photograph
photographic = photograph
And so on.
I am not a C++ programmer. I need to know how to reference a table of values in c++ (what form should the table be?) I presume Excel is not correct. I need to know how to compare my input with the table (i.e. find “able” only if the 4 right-most characters of my input match. If I’m finding on the 4 right-most characters then the function should only be performed if my input is longer than 4.
I guess this system is a little like a spell check system with auto correction. If you look at the Auto correction (not the spell check) from Microsoft Word, for example, this is exactly what I am looking for, except that the correction is only based on part of the string, and will simply remove it.
I know you cannot solve this problem for me, but perhaps you can set me in the right direction. For example, what table format should I use? How do I reference this table in C++. How do I compare parts of strings with a table (database) of values.
Any help at all would be fantastic. I know this is a big job for someone who has never used c++ before, but I am determined to do it!
Rigsby
|
|
|
|
|
Dear all
I write one dll in VC++ 6 IDE that is used in borland C++ builder environment.
I use the _pgmptr to get the execution path. but if we use the dll in builder IDE then the _pgmptr returns NULL.
would you please inform me another possible routines to get execution path.
Regards
Mahdi
|
|
|
|
|
Interesting, I'd not come across that before.
The best way to get the full path to the executable running in the process is to use GetModuleFileName . Pass NULL for hModule to get the executable's path, or the hInstance value passed to your DLL's DllMain to get that DLL's path.
Looking at the C run-time source code (in STDARGV.C), I see that _pgmptr is actually initialised from the result of GetModuleFileName . This code is called from mainCRTStartup and the corresponding routines for Unicode and Windows GUI EXEs, but isn't called for a DLL (it wouldn't make sense).
|
|
|
|
|
tanx alot
|
|
|
|
|
Hi all,
I am in a task of printing something using my VC++ Programme.
In Print Preview I am getting my page in Portrait Orientation.
But I want to change it into LandSpace using my VC++ Programme.
How can I Achieve it .
Thanks in Advance.
Yours Faithfully
George K Jolly
|
|
|
|
|
|
Did you see DEVMODE and DMORIENT_LANDSCAPE/DMORIENT_PORTRAIT
|
|
|
|
|
I'm trying to write a C++ .NET program that will move an image very quickly across the screen. Maybe all the way across in one second. What would be the easiest way to do this? All the timer functions perform incorrectly at intervals small enough to do what I want, so i'm looking for a different solution. Will GDI+ do it, or do I have to move to DirectX? I'm looking for something simple, hopefully, but that wont be excessively choppy... only moving at about 2-3 pixels at a time hopefully, so the interval would have to be around 4-5 milliseconds. Again, timer functions dont work correctly at intervals this small.......... thanks for the help!
|
|
|
|
|
Firstly I'd suggest bypassing the whole problem by using an .AVI animation and the Animation common control. If that doesn't work for you, I'd suggest looking into the multimedia timers[^].
|
|
|
|