mitrmkar 1,056 Posting Virtuoso

If the file happens to be empty, then Ed really rules here ;)

mitrmkar 1,056 Posting Virtuoso

You can use also stringstream to convert to int

int final;
stringstream strm;
char * value_a = "123456";

strm << value_a;
strm >> final;
mitrmkar 1,056 Posting Virtuoso

Please take the time you need to get familiar with code tags

mitrmkar 1,056 Posting Virtuoso

You are not trying to save anything to the file, i.e. there are no calls to any function that would write to the file. If you are familiar with printf(), try looking up fprintf() and using it to write to the file.

Last but not least, learn to use the code tags when you post code.

mitrmkar 1,056 Posting Virtuoso

Thaks it solved that problem. Now i'm getting the following error message
[Linker error] undefined reference to `vtable for ConjVector'

You have one or more virtual methods declared but not implemented in the class.

mitrmkar 1,056 Posting Virtuoso

Would this be of any help?

You also need to convert the RichTextBox's Handle to a window handle (i.e. HWND).

mitrmkar 1,056 Posting Virtuoso

About feof() in my snippet - it's absolutely safe and correct function call.

What if the last line contains the id being searched for and that line does not end with a newline?

mitrmkar 1,056 Posting Virtuoso

The declaration only is not enough, so ...

// in ConjVector.cpp

// initialize enMemoria to some value ...
int ConjVector::enMemoria = 0;
mitrmkar 1,056 Posting Virtuoso

Have you tried doing the DxDiag.exe tests?

mitrmkar 1,056 Posting Virtuoso

The ending backslash works as a continuation character, turning the following line into a comment too.

mitrmkar 1,056 Posting Virtuoso

Hey thanks for that... :) I bumped my head on the wall for that... It only works single digit I dunno if there's a possible snippet or code that works also in more than 1 digit.... decimal value and exponents... do you have any tip for me?

:icon_rolleyes: try to get in touch with the author of this code and ask if he kindly could/would supply you with the necessary code.

mitrmkar 1,056 Posting Virtuoso

Just wondering if theres a function to get the window title of your browser.

Like if you were to visit www.myspace.com your window title would be: www.myspace.com - Mozilla Firefox

or w/e browser you happen to use.

Is there a way to get the title of a window?

Use GetWindowText() once you have the handle to the correct window.

mitrmkar 1,056 Posting Virtuoso

I just learned how to copy a file, now the question is, how can you tell if a file has been copied or not? I think I need a command or a function that allows me to check whether if the copied file does exist in the destination folder. Can anyone please give me a suggestion.

Write yourself a function to copy a file, so that it e.g. returns false if copying fails, else true. I.e. if your function returns true, then you know that the file was copied (and hence no need for any extra checking).

mitrmkar 1,056 Posting Virtuoso

well here is the main code...

:yawn: and here is probably the original copy (without the copy/paste errors).

Wouldn't it really be better for you to write the program from the ground up (in terms of really learning something) ?

mitrmkar 1,056 Posting Virtuoso

The code is too big to paste here so if you want a copy of it email me at vs49688@yahoo.com.au and ill email you a copy.

An alternative is to zip the project and post it as an attachment.

mitrmkar 1,056 Posting Virtuoso

You might use the std::string class, see for example
string::operator+=

mitrmkar 1,056 Posting Virtuoso

Just related to the while() loop you have devised

while( jump == true )
{
    newy += gravity;
    
	if( newy > FLOOR_Y )
    {			
        newy = FLOOR_Y;
        jump = false;
        break;
    }
}

if you look at it closely, you'll see that it actually can be written as follows

if( jump == true )
{
    newy = FLOOR_Y;
    jump = false;
}
mitrmkar 1,056 Posting Virtuoso

I meant that you were misusing the assignment operator = there

if(jump = true)  // sets 'jump' to 'true'
while( jump = true ) // sets 'jump' to 'true'

instead, to check whether jump is true , use ...

if(jump == true) 
// or ...
while( jump == true )
mitrmkar 1,056 Posting Virtuoso

Since you have printVector(vector<T> & x) pass by reference ... printVector( x );

mitrmkar 1,056 Posting Virtuoso

One obvious little error ... if( jump = true )

William Hemsworth commented: Well spotted :) +3
mitrmkar 1,056 Posting Virtuoso

Nothing is printed

Assuming you have changed your code, you could post the complete current code.

mitrmkar 1,056 Posting Virtuoso

I'd suggest that you check the return values of the FMOD function calls, and use the FSOUND_GetError() to figure out an error, i.e.

int main() //<- main() returns an int
{
    if( ! FSOUND_Init (44100, 32, 0))
    {
        // initialization failed ... what is the error code?
        const int errorCode = FSOUND_GetError();

        return errorCode;
    }

    FMUSIC_MODULE* handle=FMUSIC_LoadSong("Chiquitita.mp3");

    if(handle == NULL)
    {
        // Load failed ... what is the error code ...
        ...
    }        

    ...

    return 0;
}

See the FMOD documentation for the details on each function you use, so you'll learn how to use them properly.

mitrmkar 1,056 Posting Virtuoso

Vista security rendered 'uselsess'

hmm, smells like hype, but let's see.

mitrmkar 1,056 Posting Virtuoso

When I add default constructor to bigInt this problem is solved

OK, that problem is presumably solved.

but object n is not created accurately and I got runtime exception while accessing n.
What is my fault?

I'm guessing that you are using the pointer value uninitialized/unallocated. Couldn't you change that to a simple: unsigned value; You might also post the actual code that's giving you the error.

mitrmkar 1,056 Posting Virtuoso

When you post code, use code tags, i.e.
[code=cpp]
< paste your code here in between the tags >

[/code]

Below is a close-to-compilable version for e.g. VC 2005, the errors that are left, are about the usage of pow() and sqrt() functions. Your choice of argument types for these functions do not match the function signatures, meaning that you may want to change the respective data types or type cast the arguments as needed. I think ArkM pretty much pointed out that already earlierly.
Also I added using namespace std; , if you are not lazy, you can replace it with what ArkM suggested earlierly (i.e. using std::cout etc).

#include "stdafx.h"

#include <fstream> // <fstream.h>
#include <iostream> 
#include <conio.h>
// #include <string.h> // not used anywhere
// #include <stdio.h> // not used anywhere
// #include <process.h> // not used anywhere
#include <cmath> // <math.h>
#include <iomanip> // <iomanip.h>

using namespace std;

/* some global variables to store maximum scanning area in x,y direction and grid distances */
int x,y,k,l,a,b;
/* p,q will store value to be used in calculation using formula */
float p,q;

/* global arrays to store sum of various sigmas which are used in formulae */

// float distance[5000] => float distance0[5000]  to avoid colliding with std namespace.

float distance0[5000],distance1[5000],distance2[5000], tw[5000];

/* a class named as data where voltages will be stored */
class data
{
public:
	int x_component,y_component;
	float real_z1,imaginary_z1;
	float real_z2,imaginary_z2;
	void getdata();
}d[5000],f[5000];

int c=0;

/* function …
mitrmkar 1,056 Posting Virtuoso

I dereference them once to get access to LOD, but this doesn't seem to work. Why not?

Dereferencing was actually missing ... i.e.

if( (*(visualEntity.begin() + i))->LOD == wantLOD){
mitrmkar 1,056 Posting Virtuoso

whoops, I meant to say,

push the FILENAME object (that is on the heap) into the list called "files"..

is that right?

No, the point is that the specific object that you have on the heap, is NOT stored into the list. Instead, the derefenced pointer which you supply to push_back(..) is only used to construct another object (via copy constructor) that IS stored into the list. The initial object on the heap will happily remain there unless you issue delete on it.

I did not declare my list as: list <FILENAME *> files;

I know, I wrote "If your list would be declared as list <FILENAME *> files;", maybe you missed it.

Could you clarify what you meant with the last paragraph?

isn't this a pointer/heap allocation:? FILENAME* filePtr = new FILENAME;

Yes it is.

Once again ... no pointers/explicit heap allocations whatsoever need to be involved. I.e. you can write:

vector < FILENAME > files;
string fname;

for( ... some loop condition here ... )
{
    fname =  ... some code here that builds the file path ...

    FILENAME file;
    file.SetFullPath(fname);
    // invoke copy constructor and store a new object (a copy of the 'file' object) 
    files.push_back(file);
}
krebstar commented: Thanks :) +1
mitrmkar 1,056 Posting Virtuoso

would it still cause memory leak if i did this?

else // it is a regular file, so push this onto our list
			{
				fname = path + "\\" + ffd.cFileName; // this is the full path name that we want to push into our list
				
				FILENAME* filePtr = new FILENAME; // create a FILENAME pointer to a FILENAME object on the heap
				
				filePtr->SetFullPath(fname); // pass the "fname" into the FILENAME object on the heap
				
				files.push_back(*filePtr); // push the FILENAME object on the heap into the "files" list

				delete filePtr;
			}

At any rate, would it simply be better to point the pointer to a static object like "file" in your example, rather than allocating one on the heap, in terms of performance? Thanks..

delete filePtr; would prevent any leaks.

files.push_back(*filePtr); // push the FILENAME object on the heap into the "files" list

That does NOT push the object on the heap into the list, instead it invokes the copy constructor of FILENAME constructing the object that ends up into the list.
If you write yourself a copy constructor ...

FILENAME(const FILENAME & o)
	{
		cout << "FILENAME / copy constructor\n";
		name = o.name;
	}

that will display the text each time you call files.push_back(...) .

If your list would be declared as list <FILENAME *> files; then you'd need to be new'ing the objects you store in the list. But since you are storing FILENAME objects, no pointers/explicit heap allocations whatsoever need to be involved.

mitrmkar 1,056 Posting Virtuoso

is it possible that i can post here my whole project...not big though..and u can solve the errors???they all r general...u will not take much time...if it take, you can leave..
plz can you help me???

Well, you can give it a try of course and see how it goes.
The other (suggested) method, is to work it out one error at time, i.e. recompile after every fix you think you've made. And when stuck on an error, post a question here ...

mitrmkar 1,056 Posting Virtuoso

Maybe I should: FILENAME* filePtr = new FILENAME; and then filePtr->SetFullPath(fname); and then files.push_back(*filePtr) Does that sound right?

That would leak memory because push_back() invokes the copy constructor of FILENAME i.e. you would not be storing the new'ed object anywhere, instead use simply ...

FILENAME file;
file.SetFullPath(fname);
files.push_back(file);
mitrmkar 1,056 Posting Virtuoso

i m getting

error c3861: 'clrscr': identifier not found..

how to solve this?

That's a non-standard function not supported by MS, for equivalent functionality, see http://support.microsoft.com/kb/q99261/

mitrmkar 1,056 Posting Virtuoso

You need to #include <iomanip>

mitrmkar 1,056 Posting Virtuoso

Your code probably should be doing what the comment there already says (without any iterator(s))...

else // it is a regular file, so push this onto our list
{
	fname = path + "\\" + ffd.cFileName;

        // assuming you have a FILENAME object ...
	aFILENAME.SetFullPath(fname);

        // now at to the end of the list ...
	files.push_back(aFILENAME);
}
mitrmkar 1,056 Posting Virtuoso

We only can help if you post the code/errors.

mitrmkar 1,056 Posting Virtuoso

If you are interested in what's on the floppy at certain location, you might use ReadFile().

mitrmkar 1,056 Posting Virtuoso

Im not sure what you mean by passing the address of the structure, and not the struct itself?

You are missing ...

bResult = DeviceIoControl(hDevice,  // device to be queried
      IOCTL_DISK_GET_DRIVE_GEOMETRY,  // operation to perform
                             NULL, 0, // no input buffer
                            & pdg, sizeof(pdg),     // output buffer
                            &junk,                 // # bytes returned
                            (LPOVERLAPPED) NULL);  // synchronous I/O
tootypegs commented: thank you for your help +1
mitrmkar 1,056 Posting Virtuoso

You need to pass in the address of the DISK_GEOMETRY struct, not the struct itself.

mitrmkar 1,056 Posting Virtuoso

For Windows, you have to use Gotoxy(x,y), and include the right header file for it

Just out of curiosity, in which header can one find [B]G[/B]otoxy ?

mitrmkar 1,056 Posting Virtuoso

i mean can you please show me an example of making 3 msgboxes cuzz ive tried doing it but only to open up so i just want a example so i can learn from it..

A minimal example of displaying three message boxes, each message box is displayed by a dedicated thread ...

#include <windows.h>

DWORD WINAPI ThreadProc(LPVOID lpParameter)
{
    MessageBox(0,"Hello World From a Thread", "Hello World",MB_OK);
    return 0;
}

int main()
{
    DWORD dwThreadID = 0;

    // first thread ...
    CreateThread(0, 0, ThreadProc, 0, 0, &dwThreadID);   

    // second thread ...
    CreateThread(0, 0, ThreadProc, 0, 0, &dwThreadID);

    // and the third thread ...
    const HANDLE hThread3 = CreateThread(0, 0, ThreadProc, 0, 0, &dwThreadID);

    // the program waits on the hThread3 handle, i.e.
    // as soon as the message box displayed by the
    // thread #3 has been closed, the program will terminate
    WaitForSingleObject(hThread3, INFINITE);

    return 0;
}

Note that there is no error checking whatsoever, but maybe you get the idea. Also note the WaitForSingleObject() , without it, you probably would not get to see any of the message boxes.

The other alternative using modeless dialog boxes, would probably be easier for you (i.e. you can display as many message boxes as you want without multiple threads).

mitrmkar 1,056 Posting Virtuoso

ive been trying to google it but i am not finding what i am looking for..also i am not the best when it comes to programming windows programs ..

Unless you use modeless dialog boxes, as suggested by Ancient Dragon, you need to have multiple threads in order to display multiple message boxes simultaneously by means of the MessageBox() function.

mitrmkar 1,056 Posting Virtuoso

You've gotten a bit confused about how to use the CreateWindowEx() function, the following should work ...

hList = CreateWindowEx(
    WS_EX_CLIENTEDGE,
    "ListBox", // the window class here 
    "Caption text ...", // needs WS_CAPTION style in order to be shown
                        // .. see below
    WS_CAPTION | WS_CHILD | WS_VISIBLE | WS_VSCROLL,
    10, 10, 100, 200, 
    hwnd,
    (HMENU) IDC_LISTBOX1,
    GetModuleHandle(NULL),
    NULL);
mitrmkar 1,056 Posting Virtuoso

the problem is that after the ::SendMessage(hwnd, WM_GETTEXT, 256, (LPARAM)buf); line
buf got a partial string of the window title (it cuts first characters) for example instead of "Continue" it hold "inue" and etc....

what could be the problem?

You seem to be experiencing what MS has (vaguely) documented as follows:

Windows NT/2000/XP:ANSI applications may have the string in the buffer reduced in size (to a minimum of half that of the wParam value) due to conversion from ANSI to Unicode.

Try coding the mFindWindowOnlyByCustomTitle() in Unicode to avoid the internal Ansi to Unicode conversion.

mitrmkar 1,056 Posting Virtuoso

I think I fixed everything now the program end abruptly after the second menu.

There is more to fix, consider e.g. return weapChoice,charaChoice,uname; And really, you should format the code as already suggested, for example, the getWeaponSelection(...) function is pretty much unreadable as of now.

mitrmkar 1,056 Posting Virtuoso

hi i am dipali i am trying to store multiple objects in file but it will store only one object with the help of read & write function plz tell me solution.

Maybe you open the file so that it gets truncated every time, i.e. the mode parameter is wrong?
See http://www.cplusplus.com/reference/iostream/fstream/open.html

mitrmkar 1,056 Posting Virtuoso

You need to change e.g. if(Addition = true) to if(Addition == true)

mitrmkar 1,056 Posting Virtuoso

Try replacing the line PaintRoutine(hwnddc, GetPixel(hDC, pt.x + x, pt.y + y), 1, 1, 1 + x, 1 + y); with SetPixel(hwnddc, x, y, GetPixel(hDC, pt.x + x, pt.y + y));

mitrmkar 1,056 Posting Virtuoso

So what compiler should I use then?

MFC is Microsoft's commercial library and is not available for free. So you'd need to buy one of the Visual Studio editions that come with MFC.

mitrmkar 1,056 Posting Virtuoso

I meant the project in the link

How would you compile that ?

That project uses MFC which is not included in the Express Editions, meaning that you cannot compile it.

mitrmkar 1,056 Posting Virtuoso

Linking...
sub_proc.obj : error LNK2019: unresolved external symbol __imp__InitializeSecurityDescriptor@8 referenced in function _process_init

You need to link with Advapi32.lib.

mitrmkar 1,056 Posting Virtuoso

need help in php coding !!!!!!!!!!!!!!!
not able to send values to database.................
hav checked the code many times............
when i apply conditions in my code ...it simply stops sending values to database...
plz help.........

This is a C++ forum, but here is a dedicated forum for PHP. Try posting your questions there.