|
I have got the following in a header file for a class:
#include <vector>
#include <math.h>
In the class description, I have the following protected member:
vector<Point2D> samples;
Point2D is defined as a class
during compile time I get lots of errors (C2143, C4430 and C2238)
Any ideas?
|
|
|
|
|
Try
std::vector<Point2D> samples;
whenever you use a vector in a header file, you should include the std:: prefix.
What the errors mean. (C2143, C4430 and C2238)
error C2143: syntax error : missing ';' before '<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2238: unexpected token(s) preceding ';'
modified 6-Aug-12 13:50pm.
|
|
|
|
|
Make sure the file where you defined this vector also knows that Point2D is a class. So don't forget to include the header where the class is defined within this file. That may be your problem...
|
|
|
|
|
How to ensure the file which I download and the file on the server is the same one?How can I get the file's MD5 value or CRC value before I download it?If file server give this value to me.Will it make the file server too much pressure?(forgive my bad english)
|
|
|
|
|
Both protocols have their advantages but I think http is more modern and often better. I also favor http because I often build in cgi scripts to perform certain tasks on the server side.
About the CRC: None of these protocols support getting crc. I would use the file time to check if the files are up to date on the client or not. With http you can use HEAD requests to get only the head part of a full request without data, that contains the filetime, size, etc... If you can put in cgi scripts into your http server then you can build in a crc calculator/getter cgi but I think putting heavy load on the server is generally a bad idea. In ftp I don't know if getting crc is possible but my guess is no.
modified 6-Aug-12 10:47am.
|
|
|
|
|
Thanks a lot,now I solved this problem.The file is uploaded by java in web service and a crc32 value is
calculated after that.I juust send a message to server.It get me the value.So I know this value.I download the file,calculate the file's crc32 value.At last,I compare two crc32 values.
|
|
|
|
|
All well that ends well. Forgot to mention that you can solve it easily with pure HTTP + cgi script as well. If you have the crc3 values precalculated on your sever lets say in x.txt.crc32 for x.txt then the cgi script could handle HEAD requests and it could send a response back to the client that has a custom response header like crc32=blahblah. But its OK if you found a similar solution, java web containers are quite flexible if you used tomcat or something like that...
|
|
|
|
|
[This] is an informative read on FTP vs. HTTP.
|
|
|
|
|
Nice fight between FTP vs HTTP.
I would remove the 'Never chunked encoding "overhead"' point from the list of advantages of FTP because the chunked encoding is a feature of HTTP that shouldn't be used in case of fixed sized files - and usually it isn't used at all in such cases. On the other hand some problems - like streaming an unknown sized log file incrementally (one that isn't closed and finished yet) can only be solved with chunked encoding. So it is a feature that is overhead only if abused.
|
|
|
|
|
Another 2 things I like more in HTTP:
1. It uses just one connection, while FTP uses separate command/data channels.
2. HTTP is usually less bothersome when it comes to firewalls.
|
|
|
|
|
Hi,
I have created a dialog in MFC. I have one child dialog. Child dialog opens on clicking a button in Parent dialog. I have two check boxes in child dialog. When child dialog opens first time, On clicking a button, I am selecting one check box by default. I have made check boxes work like radoi buttons. Now when I click on the button second time and select another check box and do something, third time clicking on the button default check box again get selected. I want to retain the state of selected check box, until I close the main application. If I have selected a check box, it should remain selected when I again click on the same button.
Anybody have any idea.?
Please let me know if u want further clarification.
Thanx & Regards,
|
|
|
|
|
Write public methods in the child dialog class to get and set the state of the check boxes.
In the parent dialog, after the child dialog's DoModal returns, call the methods of the child dialog class to get the state of the check box.
While calling the child dialog in the parent dialog class, after creating the child dialog and before calling the DoModal function, call the child dialog methods to set the state of the checkboxes.
|
|
|
|
|
Hi,
Thanx for the response.
its done.
Regards,
|
|
|
|
|
does anyone know how to get the text of WordArt with VBA or C++
=========================================================
additional : what kind of object is WordArt? inlineshape? shape? or something else. 3ks very much.
modified 6-Aug-12 3:18am.
|
|
|
|
|
What has your question to do with the C/C++/MFC forum?
Veni, vidi, vici.
|
|
|
|
|
I'm sorry. I want to complete this function in C++. But I have no idea how to do it.
|
|
|
|
|
On click of a ribbon button menu whose member variable is declared at cRibbonView class i would like to know a way to change the text at the status bar(ribbon) whose member variable is declared at cMainFrm class.
Can please someone give a sample code too..
Thanks..
|
|
|
|
|
Hi friends
I have à sourcepakket of à console application That would be called
from command line with soms like
Appname 10 w 30
So THE name of THE app and three arguments
Now i want to write à Windows gui around this code with as little
effort as posibble by valling THE old main() from within this windows code.
But i do not knowhow how to parse THE argument. Supposedly i schuld set up argc and argc.
Can any one tell me how to do this?
Would save me à lot of work
Any help appreciaties.
|
|
|
|
|
You can do it quite simply via the system() [^] API call.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
If the application has any console output/input then using system() per the other suggestion would probably be the best choice.
If not and you want to call main() directly then just create an array with three entries ("10", "w", "30") and set argc to 3.
|
|
|
|
|
|
Try this.
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
typedef TCHAR tchar;
typedef std::basic_string<tchar> tstring;
typedef std::basic_stringstream<tchar> tstringstream;
typedef std::vector<tstring> arg_vector;
bool filter(char c)
{
return (c == '\"');
}
arg_vector cmdline_to_argv(tstring const & cmdline)
{
arg_vector args;
if (cmdline.empty())
return args;
bool together = false;
bool only_spaces = true;
tstring::size_type laststart = 0;
for (tstring::size_type n = 0; n < cmdline.length(); ++n)
{
if (cmdline[n] == '\"')
{
together = !together;
}
bool space = !!isspace(cmdline[n]);
if (space && !together)
{
if (!only_spaces)
{
tstring arg = cmdline.substr(laststart, n - laststart + 1);
arg.resize(std::remove_if(arg.begin(), arg.end(), &filter) - arg.begin());
args.push_back(arg);
}
laststart = n + 1;
}
if (space)
only_spaces = true;
else
only_spaces = false;
}
if (!only_spaces)
{
tstring arg = cmdline.substr(laststart, cmdline.length() - laststart + 1);
arg.resize(std::remove_if(arg.begin(), arg.end(), &filter) - arg.begin());
args.push_back(arg);
}
return args;
}
int main(arg_vector const & args)
{
tstringstream strm;
strm << args.size() << " arguments!\n";
for (arg_vector::size_type n = 0; n < args.size(); ++n)
strm << "Argument #" << (n + 1) << ": " << args[n] << "\n";
MessageBox(NULL, strm.str().c_str(), TEXT("Command Line Test"), MB_OK | MB_ICONINFORMATION);
return 0;
}
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev_instance, LPSTR cmdline, int show)
{
return main(cmdline_to_argv(GetCommandLine()));
}
|
|
|
|
|
hi all,
BEX runtime error occur in my application .
i dnt know why its comes and how can i resolve this?
please guide mr for this.
thanks.
|
|
|
|
|
As someone else told you the other day, you've been here long enough that you should know how to ask a sensible question. Until you do so, we can't help.
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Use your debugger, and your brain.
One of these days I'm going to think of a really clever signature.
|
|
|
|