I've checked it on RH linux too with gcc compiler. Sorry sir, it's not repeatable. Could you please let me know some more details about the program? One possibility is that, this is the part of your big program and something is already there in stdin stream. Did you check the mentioned code as a separate program?
Arvind Bharti
Posts
-
scanf bug? -
Hard question about Critical section - in C++ ....A critical section is a small section of code that requires exclusive access to some shared resource before the code can execute. To protect that section of code we need to encapsulate that code in EnterCriticalSection and LeaveCriticalSection function call. Better avoid using 'block' terminology.
-
Casting pointer to pointer of class [modified]This is just another way of exploiting power of pointers provided by C++. But this is not considered as good practice.
-
scanf bug?It is working perfectly fine in Visual Studio 6.0. Could you please give us some more details about Compiler, Operating System OR any information worth to repeat this problem?
-
Unmanaged ThreadingIf we are using Win32 APIs only, then CreateThread would be good enough but if we are using any CRT function that requires tiddata structure, it is must to use _beginthreadex function. Otherwise memory leak will occur because CloseHandle, corresponding to CreateThread API, won't free the dynamically allocated tiddata structure. There is one more problem related to SEH frame. For better understanding, please go through following link: http://www.microsoft.com/msj/0799/Win32/Win320799.aspx
-
GetTextMetricsplease try the following code: ---------------------------------------
hOldFont = SelectObject(hfont1); GetTextMetrics(hdc,tm1); TextOut(hdc, ....); y += tm1.tmHeight + tm1.tmExternalLeading; // Do not forget to clean up. SelectObject(hdc, hOldFont); DeleteObject(hfont1); hOldFont = SelectObject(hfont2); GetTextMetrics(hdc,tm2);
--------------------------------------- -
[Message Deleted]Have you heard of “Writing Solid Code” book? Last Chapter is “The Rest is Attitude”. Whatever books you read, whatever tricks you learn, at the end it come the attitude, that drives us to go beyond the good, to go extra mile and to reach excellence. It is not only for programming job, but it is applicable to any kind of job. And this is applicable to the whole world. It has nothing to do with a specific country. Communication skills are not necessary to become a good programmer. Yes it adds one more feather to your cap and helps you to compete on world stage. All I can say for you is that it’s your bad luck that your experience with Indian programmers is not good.
-
Run multiple process in parallelI am confused with the subject and the content of message. Subject states you want multiple processes and message talks about threads. Could you please be more specific? In case of process, use kernel-objects like events, mutex, semaphore etc. to synchronize and for threads you can use user-objects like critical section(as well as kernel-objects).
-
[Message Deleted]Look at this :confused:person who don't know where to post this kind of discussion topic is raising questions over Indian's programming skills and communication. Better correct yourself rather than passing comments. ;P :-> :zzz::zzz::zzz::zzz:
-
string ArrayRather than returning the value, pass the paramter as a reference. void myclass::getStr(CStringArray& csa) { csa.Add("str1"); csa.Add("str2"); }
-
Ignored inline keywordKindly look at the another reply thread started by Ryan. Hope you would be able to understand my question.
-
Ignored inline keywordThanks Ryan and Stephen. Yes using map files i can find the required information. But still this is manual and I need to manage the list of all inline functions. It will become cumbersome to maintain this list because we can define inline functions in header files without using inline keyword. I am looking for something that can automate this.
-
Stop the screen from dissapearIn case if you don't have any issue in using C functions in C++, then include conio.h and add the following code at the end of function. cout << "Press any key to exit."; getch();
-
how does copy constructor works with vector::push_backTo avoid these extra copy constructor, call reserve function. like vec.reserve(5); Everytime you calls push_back, vector has to expand the memory block and copies the elements from the original to new memory block. Here comes the copy constructor in picture. As the size of vector increases, the number of calls of copy constuctor keeps on increasing(directly proportional to number of elements in vector).
-
Ignored inline keywordIt seems you didn't get my question. I don't have any doubt in how to use inline. I know all the rules of inline. What i am asking is how to find the list of inline function(s) for which compiler has ignored the inline keyword?
-
UTC time Clock and Local time Clock?The gmtime, mktime, and localtime functions use the same single, statically allocated structure to hold their results. Each call to one of these functions destroys the result of any previous call. Please check the address stored in ptrLocalTime and ptrUTC. Both are same. So you have to make a copy before calling another function.
-
Ignored inline keywordIn C++, inline keyword is a request to a compiler. Compiler can ignore it. Apart from poking through .asm files, is there any way to to find the list of inline function(s) for which compiler has ignored the inline keyword? May be some compiler setting(s) to generate the report containing this information. -- modified at 23:55 Thursday 30th March, 2006