|
Use SetWindowPlacement with WPF_SETMINPOSITION.
|
|
|
|
|
ok... in this code... you dont have to worry where everything is being defined or what headers im using,... wheres my functions... this is just the main program... It all works the first time through, then, the cin stops working:
int main()
{
for(;;)//main loop
{
gets(SName);
cin >> SGPA;
person.SetName(SName);
person.SetGPA(SGPA);
cout << person.GetName() << endl << endl; //print name that you just typed.
for(int inc = 0;inc < NN;inc++) //print all names.
{
cout << Names[inc] << "\t" << GPAS[inc] << endl;
}
inc = 0;
}//end main loop.
return 0;
}
in the program is waits for input for the name of sombody... then it goes on to the next thing... which is my cin statment, asking for the float "GPA" of the persons name you put in. after the first time you run through the on going loop... your not able to insert a GPA, rather, for every new name you put in... it applies the original GPA to the names.
Q~How do i reset my cin or get it to work everytime in the loop. set it to null?
Thanks!
~SilverShalkin
i have a fealling that it might not be the cin but i'll see in a bit
|
|
|
|
|
cin.flush() should solve your problems, I reckon.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
CString str = "8000";
doulbe dbl;
dbl = atof( str );
dbl = dbl / 1000;
str.Format( "%d", dbl );
MessageBox( str );
Should that output 8, or is it wrong?
-Raffi
|
|
|
|
|
It is wrong.
When you say %d str.Format expects an integral argument 4 bytes wide. Double is 8 bytes wide so str.Format takes the leading 4 bytes and displays it thinking it to be a valid integer.
|
|
|
|
|
you are correct!
str.Format( "%d", int (dbl) );
is ok!
|
|
|
|
|
Use %f instead of %d
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Raffi wrote:
doulbe dbl;
Am I the only one that noticed 'doulbe' or did everyone just disregard that as an error while typing the post?
|
|
|
|
|
I just regarded it as an error - his compiler would report it, and if he couldn't figure that out, he should probably move to Logo.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Does anyone know how I can open a file with iostreams and get it's size without first writing to it ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Probably seek to the end and get the position. that would be the size.
|
|
|
|
|
After I posted, it occured to me: I'm opening an ofstream because I only want to write, and so I need to write before I have a position, but if I open an fstream, I can probably do a read to get that info without writing anything....
thanks.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Just out of curisoity why do you need the file length when you are writing to it? Do you want to append? In that case ios::app would be good enough (But I don't think that you would miss that).
|
|
|
|
|
Nope - what I want is to know when the file hits 10k so I can archive it and start a new one.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Open the file, call tellg , go to the end of the file with seekg(0,ios::end) , call tellg again and calculate the difference.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi All,
I've got a CFormView derived view that I need to be able to add some fancy edit controls to at run time. Based on some input from the user, I will have what's essentially a set of edit controls inside a group frame, with anywhere from say 1 to n edit controls, but I won't know how many until runtime.
So, I was guessing this might involve calling CreateWindow directly, but not too sure. The edit controls are actually edit derived ActiveX controls, that do some additional stuff on top of the basic edit control stuff. I remember seeing some sample somewhere for something like this, and it seems like you called CreateWindow and pass in the progid of the control somewhere, but I can't remember the details.
Anyone done something similar?
Thanks,
Aaron
|
|
|
|
|
Typically, you'll have an array of pointers to CYourEdit s. After constructing this array with something like:
m_array=new CYourEdit*[m_nControls];
for(size_t n=0;n<m_nControls;++n)m_array[n]=new CYourEdit(); you'll have to create each of the controls. The actual creation method depends on the type of the controls, but chances are you have to pass the parent window, the rectangle the control is enclosed in and a control identifier (use 0xFFFF .)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How do copy a CString to a BSTR and vice versa?
|
|
|
|
|
comutils.h ( from memory ) is an include that defines _bstr_t, which internally converts between the two formats. It has a copy() method to return a new BSTR, the one it wraps is deleted in the destructor.
CString s = "22tgsdfdsa5rwer";
BSTR b = _bstr_t(s.GetBuffer()).copy();
CString a = _bstr_t(b);
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
CString str = "Test";
BSTR bstr = str.AllocSystString();
CString str1(bstr);
|
|
|
|
|
I would like to have my program look into a directory and return back all the filenames within it. Does anyone know what the class and function call does this?
Thanks!
|
|
|
|
|
FindNextFile API function or CFindFile MFC class.
Like it or not, I'm right.
|
|
|
|
|
Ah, so trivial. I can't believe I missed it Thanks!!
|
|
|
|
|
When I try to envoke the class wizzard I get the following error:
Parsing error: Identifier Expected.
Input line: ";"
Ok
Anybody know how to resolve this problem? Any help would be sincerely appriciated as I'm dead in the water.
Thanks!
|
|
|
|
|
How does the .clw file look like. You can edit it and restore it.Otherwise delete the .clw file and press Ctrl+W in the resource editor screen. This would restore the clw file
|
|
|
|