|
for that u have to change settings.
step1:
go to project->settings->c/c++->cateogery
in that select preprocessor.
in preprocessor defnitions txt box _MBCS to _UNICODE
step2:
in link tab goto category.select output.
in entry point textbox write this
'wWinMainCRTStartup'
Thats all.
|
|
|
|
|
The following gives a weird output:
void test::readtext(myString file)
{
ifstream in;
in.open("data.dat");
myString t;
while (!in.eof())
{
in >> t;
cout << t << " " ;
}
in.close();
}
the file data.dat has three entries:
abc^%tytyr''lkl de$f ghi|j
but the cout prints:
abc^%tytyr''lkl de$f ghi|j ghi|j
also if I count the number of times the loop is traversed, its 4, not 3!
what am I doing wrong?
thanks,
ns
|
|
|
|
|
Problem 1: The cout doesn't match the input
I would guess that either your >> operator for the myString class isn't terminating the incoming string properly, or the << is ignoring the string length/terminator.
Problem 2: The loop is traversed 4 times
If you mean that the condition at the top of the while loop is evaluated 4 times, that would be the case. The first three times, the condition is true, and on the last iteration, the condition is false and the body of the loop is skipped.
If the entire body of the loop is executed 4 times, then I would guess that your file contains data like this:
abc^%tytyr''lkl de$f ghi|j\n
abc^%tytyr''lkl de$f ghi|j\n
abc^%tytyr''lkl de$f ghi|j\n where the \n denotes an end of line character. In that case, it may take 4 reads to get through the data, since the >> operator is probably reading up to (but not including) the end of line. Subsequent >> operations skip over the end of line as whitespace, thereby requiring 4 reads.
Software Zen: delete this;
|
|
|
|
|
Thanks for the help.
|
|
|
|
|
I am trying to determine the amount of time that some functions in my program are taking to execute. I am currently using the clock() function at points before and after the function call being timed, and then dividing the time difference by CLOCKS_PER_SEC. I only seem to be getting three decimal places of precision in the resulting number of seconds. Is this the best way to accomplish something like this? I have included a generic sample below:
Sample:
#include <ctime>
time_t t1,t2;
double time;
t1 = clock();
function();
t2 = clock();
time = difftime(t2,t1) / CLOCKS_PER_SEC;
Thanks,
josh0526
|
|
|
|
|
|
josh0526 wrote:
I only seem to be getting three decimal places of precision in the resulting number of seconds.
Probably because CLOCKS_PER_SEC is 1,000.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi all,
I'm going out of my mind on this problem and would really appreciate some help. I am currently writing an NT service that has two threads running. One thread is at a point where it has to create a network message and send it over a socket. However, when I try to malloc some memory for a buffer I get an NT_STATUS_ACCESS_VIOLATION exception. The code looks simple enough to me:
totlen = sizeof(BH_MESSAGE) + msglen;
char* totbuf = (char *) malloc(totlen);
Any ideas coz I'm really going crazy
Regards,
Mark
|
|
|
|
|
Probably the heap got corrupted before your malloc call. A buffer overrun is the most common cause, and it's usually a hard thing to find; there are several tools on the market to help debug heap corruption.
A simple (and cheap) thing to try is calling _CrtSetDbgFlag with at least the _CRTDBG_CHECK_ALWAYS_DF flag set.
Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski
|
|
|
|
|
any idea in making a menu bar in win32 console application?
any libraries or method???
thanks
|
|
|
|
|
You can make an app that is win32 that emulates a console in a rich edit view.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
can u explain more about this... cause i cannot get what u mean?
|
|
|
|
|
I am trying to make it easy for you. Menuing is already implemented in Win32, you might as well use the existing system. Otherwise you must go waaaaaaaaay back in time and dig up some library like turboC to implement this.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
the problem is i need to complete my coursework in Win32 "CONSOLE" application... i need to make a "menu bar" below the title bar... anything can do for it? i try to use glui opengl but menu bar not inside this library...
|
|
|
|
|
silvergoat wrote:
i try to use glui opengl but menu bar not inside this library...
Damn, I think I'm all confused now ... why on earth would you need to use openGL to create a menu for a console application ?!
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Yes I am having trouble understanding the question - let alone answering it.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
Do not use OpenGL - that is a graphics library, and has very limited event (read mouse click) support. Are you being asked to write your own custom menuing system for a console application? If so - it simply a matter of doing some hard work over the next few days.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
yes... i need to write own custom menuing system for a application....
|
|
|
|
|
The data structure would something like
vector < map < string, void* > >
where the void* points to each of your functions, and the string is what is displayed in the menu.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
silvergoat wrote:
any idea in making a menu bar in win32 console application?
console ? like text only application ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
if u dunno how useful opengl in vc ++ pls... keep quiet.. thanks
|
|
|
|
|
Are you saying that asking questions to get a better understanding of the problem is prohibited?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
well, if it's for an openGL application ( not the same thing as a console application ) , have a look at GLUT, the OpenGL Utilities Toolkit (http://www.opengl.org/documentation/spec.html[^] )
If you want to do everything manually, it's a lot of work, you need to draw everything, handle the different messages ( mouse movements, callbacks, ... ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I'm trying to use the Boost Regex[^] library in my MFC SDI app but am having some problems including the files as they instruct.
I've built the library per their instructions[^]
I added the C:\boost path to my include directories for my project
I added #include <boost/regex.hpp> to the top of the file I intend to use it in ... yet I still get a compile-time error saying the following:
MyAppName fatal error LNK1104: cannot open file 'boost_regex_vc7_mdid.lib'
Any ideas what I'm doing wrong, or how to fix it?
Thanks very much,
Dave
|
|
|
|
|
You also need to add the boost library path in the options of your vc++ installation
modified 12-Sep-18 21:01pm.
|
|
|
|