|
Not sure if this is what you want. But take a look at CWnd::OnLButtonDown or WM_LBUTTONDOWN
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
|
#include <iostream.h>
#include <fstream>
#include <stdlib.h>
#include <malloc.h>
#include <assert.h>
#include "StringTokenizer.h"
class Foo
{
public:
Foo() {};
~Foo() {};
string m_first_name;
string m_last_name;
string m_title;
string m_degree;
};
void main( void )
{
char* row;
string element;
string element_from_pos;
Foo* foo;
ifstream file( "parsing_file.txt", ios::in );
if( !file )
cerr << "Greska pri otvaranju datoteke!";
row = (char*) malloc( 200 );
while( !file.eof() )
{
file.getline( row, 200 );
StringTokenizer strtok( row, "," );
int nSum = strtok.countElements();
element = strtok.getNextElement();
foo = new Foo;
foo->m_first_name = strtok.elementAt( 0 );
foo->m_last_name = strtok.elementAt( 1 );
foo->m_title = strtok.elementAt( 2 );
foo->m_degree = strtok.elementAt( 3 );
}
free( row );
delete foo;
}
|
|
|
|
|
1. Unless you click the box that says 'Display this message as is', everything between <> is lost, so we cannot see your includes
2. main returns int, not void
3. Without some description of what it should do and what it is doing, people are less likely to wade through your code and try to guess as to what you're looking for.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
void main () is perfectly legal
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
Not according to the standard, it isn't.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Yeah. I got your mail. Replied to it, but it bounced. I thought your post might confuse the original poster into thinking that, that might have been the cause of error.
Regards
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
Fair enough, although it's not quite what you said. Funny that I couldn't post and you couldn't mail me ( well, obviously both caused by our network so not really *that* funny ).
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
void main () is perfectly legal
Absolutely not!
The return-value from main() is used as the argument to exit(). Using a void main() is the same thing as using the buggy MSVC6 and writing int main() {} , where the (C++) standard explicitly states that an implicit "return 0;" should be injected before the end of main in this case.
Since Win32 IA32 returns values in eax, both the displayed MSVC6 example and your code returns whatever eax happened to to contain at the moment of return.
Nice return value to give exit(), eh?
/Mike
|
|
|
|
|
I am assuming you are using the StringTokenizer class.
If that is so, then this question would be better asked in the forum attached to that article, then the author will see it and he will answer your question.
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
Hmm, because you didn't tell what the problem is, it's kind of difficult to know why it doesn't work. However there's a memory leak: a new Foo object is created for each row in the file, but you only delete it once. What's the point of having a dynamic Foo BTW? Also, IMHO its bad practice to mix malloc/free with new/delete.
|
|
|
|
|
Hey guys
How do you launch an application from c++ i know u can use shellexecute but this uses the default program is there a way to launch a program from your program. Basically i am writing a program that needs to copy a file then launch regsvr32.exe to register this dll.
Cheers
Peter
|
|
|
|
|
Couldn't you do a:
ShellExecute(NULL, NULL, _T("regsvr32.exe yourdll"), NULL, _T("C:\\WINNT"),SW_SHOW);
not sure why you want to get away from ShellExecute.
Rob
|
|
|
|
|
Cheers didn't know you could do that.
|
|
|
|
|
CreateProcess() will also do what you want.
--CoolDev
|
|
|
|
|
The ANSI C way (according to MSDN) is to use system() .
|
|
|
|
|
Hey Guys
Sorry but i got yet another question. What would be the easiest way to copy a file from one place to the other without copying the file attributes.
Peter
|
|
|
|
|
|
how do you link to a web page in a MFC dialog program?
|
|
|
|
|
You mean create a link you can click on ? Create a static, and when the user clicks on it, use ShellExecute with the link as the property and no path, it will run in the default browser.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
did that... didn't work - pretty sure i messed up somewhere.
could you provide an example for me?
|
|
|
|
|
If you took the time to log in then I would have got an email to say you'd replied and gladly done so. It appears another solution has been offered in the meantime.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
sorry i don't have an account.
but - thanks for your time.
got it to work now.
|
|
|
|
|
Look on this site for the CHyperlink class. Trivial once you add that to the project.
|
|
|
|
|
sweet thanks for help.
got it to work.;)
|
|
|
|