|
Use std::make_pair and you don't need to explicitly state the template types, because function template instantiations will deduce the template parameters from the function parameter types:
extracted_tConst.insert(std::make_pair(tmpname, std::vector<TidePhaseAmp>(5)));
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
thanks for the proper suggestion, i implemented it and it worked.
|
|
|
|
|
I want insert checkbox in any coloum in the list view control,but I do not how to do.Using "SetExtendedStyle(LVS_EX_CHECKBOXES)" can only insert checkbox in the first coloum,please help me!
|
|
|
|
|
There are tons of articles about, here at CodeProject [^], for instance, Hans Dietrich's XListCtrl , looks promising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
FILE *f_ptr22[50];
CString ftitle[50];
for (i=0;i<50;i++)
{
f_ptr22[i]=NULL;
}
for (i=0;i<nfile;i++)
{
f_ptr22[i] = fopen(ftitle[i],"r");
}
I got "debug Assertion failed at f_ptr22[i] = fopen(ftitle[i],"r");
Expression *file!=_T('\o')
Please help: what is the problem here. Code compiled OK.
Thanks
|
|
|
|
|
You never initialize ftitle .
BTW why do you try to open again and again the same file?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Both for() loops use i , why? What is the value of i when the assertion fires?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
You are right. there was errors I fixed them. Now it works.
|
|
|
|
|
Hi
I would like to tidy up the directories. So I like to my program to read input from a sub-directory and write output to a sub-directory. All these two sub-directories are under the directory where the .exe resides.
FILE *f_ptr1;
CString ftitle;
f_ptr22[i] = fopen("rs_sf"+ftitle,"w");
fprintf (f_ptr2, "%.6lf\n",v[2*i]);
Thanks
|
|
|
|
|
your "code" does not make sense.
What's the question ?
- You know how to create files/directories and write to them ?
- You know where the executable resides ?
- You know how to check if you have permission to write there ?
As far as I know, it's bad practice to write files where the exe resides, more than often a user will not be able to do so, use the user's "document" folders.
Good luck.
Max.
Watched code never compiles.
|
|
|
|
|
mrby123 wrote: f_ptr22[i] = fopen("rs_sf"+ftitle,"w");
If you really have to, try:
f_ptr22[i] = fopen(".\\subdir\\rs_sf" + ftitle, "w");
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Thanks, I tried. It does not work. I need: if the sub directory does not exist,create it and write the file in it, if it exists, write the file in it without re-create it.
Thanks for further suggestions.
|
|
|
|
|
Well, what I showed would obviously require that the "subdir" folder exist. Use CreateDirectory() first.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Thanks.
I think I also need a test statement to check if the directory exists. If it does not exist, then create the directory. Otherwise, just write the file in the directory.
What is the statement for checking if a directory exist ?
Thanks again
|
|
|
|
|
mrby123 wrote: What is the statement for checking if a directory exist ?
You could either call _access() or let CreateDirectory() do it for you.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
As Maximilien said, programs are normally installed under the C:\Program Files directory.
You need administrative privileges to create folders and files under this directory.
You can get the Documents folder using the SHGetSpecialFolderLocation API and specifying CSIDL_MYDOCUMENTS in its nFolder parameter.
|
|
|
|
|
How can I find multiple servers Listening on our college LAN using TCP socket ?
my loop will run from ip 192.168.100.0 to 192.168.120.255.
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
The only existing technique is port scanning i.e. connect to each and everyone of them. You may wish to use threads, as response time outs will slow you down.
|
|
|
|
|
Suppose I create a thread for every subnet. .then
How many TCP sockets should i use (Per thread) ?
My loop is like this -
for(;;)
{for(;;)
{for(;;)
{for(;;)
{
connect(MySocket, ...);
}
}
}
}
then how do i decide socket's TIMEOUT if i use single socket per thread ?
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
I don't know, I've never done it I suppose it will depend on the number that answer vs the number that do not answer.
Trial and error, and selectable parameters are your friend here...
Oh, and I hope your targeting a specific port because scanning 5000 hosts * 65535 ports is going to take a long time.
|
|
|
|
|
Manmohan29 wrote: from ip 192.168.100.0 to 192.168.120.255
If you simply want to find all connected hardware addresses in this range then I would suggest using ARP[^]. The IP Helper function SendARP Function[^] is very easy to use and will quickly tell you if there is a MAC address associated with the IP. Once you have determined there is a networked device on the other side you can begin your TCP negotiation.
Best Wishes,
-David Delaune
|
|
|
|
|
You can't arp a subnet over a router.
|
|
|
|
|
Hi Michel,
The author clearly states he is on a LAN.
Best Wishes,
-David Delaune
|
|
|
|
|
And you think a lan with 5100 potential hosts has no hubs and switches? At home I can't even arp the server in the next room because there's a switch in between.
|
|
|
|