I am getting different behaviour now, but still not what I am expecting :(
Now I am getting "55525" in both cases
Use stringstream::str() instead of ignore()
.
I.e.
ss.str(""); // clear the buffer
I am getting different behaviour now, but still not what I am expecting :(
Now I am getting "55525" in both cases
Use stringstream::str() instead of ignore()
.
I.e.
ss.str(""); // clear the buffer
Example in this thread
You'll probably find How do I remove an adware by enhance.com? useful.
PS. IMO, they should change "Powered by Text-Enhance" to "Cluttered by Text-Enhance".
By body modifications I mean facial piercings, stretched piercings and tattoos. When I leave university I will have 2x 30mm (1" 1/8) ear lobes, 4mm inner conchs (cartilage in the back of your ear), 10mm septum (fleshy bottom of the nose), snake bites, 2x anti-eyebrows, and 2 sleeves, chest tattoo and a swallow tattoo on my neck.
At the point where you realize that you are scaring little kids away, you may have already lost 'the game'. ;)
Adding to what Ancient Dragon said, you might want to read up on Hungarian Notation, the same topic in Wikipedia with some criticism.
Over time, you'll probably get used to it.
I believe this happens due to a typo; Theading
vs. Threading
.
3. When I try to install driver for the HP printer I've got:
Have you tried posting at HP Support Forum?
Trying to get rid of the various C/C++ runtime versions you have installed, is not a good idea, since likely quite a lot of software you've got installed depend on them.
Can somebody give me instructions on how to install and configure this on my vps?
Perhaps take a look at Folding@home Client Installation Guides and maybe Folding@home Frequently Asked Questions (FAQ) Index, too.
Have a look at /Tc, /Tp, /TC, /TP (Specify Source File Type)
... everything you can do in C you can do in C++.
Wait .. there are Incompatibilities Between ISO C and ISO C++
I have a chopping board that looks similar. Apple should sue Walmart for selling that to me.
Hmm, maybe they will .. Apple says NO! to iPad Cutting Board
:-/
I believe you are missing an ampersand there ...
...
void serialize(Archive & ar, const unsigned int version)
...
This is somewhat off-topic (being about Facebook user's oversight instead of a scam), but anyhow, perhaps something to be aware of.
I was testing the marking of the first unused record so that later I can return the read values to main function for processing (search/filter, sort, add/delete)
In case you do read MAXDATA
records, contacts[i].first_name[0] = '\0';
will be an out-of-bounds write.
string
lives in the std
namespace, so e.g. std::string input;
ought to work.
what i have done wrong?
To get you started, delete line 138.
In your implementation file you have forgotten
void InsertionSort::insertionsort(long theArray[], int n)
I keep getting values
like
0x1ea91250 0x1ea911f0 0x1ea91190 0x1ea91130
You are printing the pointers' values -- dereferencing (*) will fix this, i.e.
std::cout << * temp->objectData << std::endl;
This would put the whole code in that file(1.c) as it is to this file(2.c).
Yes, hence your 2.c
will turn into ..
static int y=23;
void abc(int a){
printf("%d\n",a);
}
int main(){
abc(12);
printf("\n");
printf("%d\n",y);
return 0;
}
giving you a file-scope variable y
perfectly accessible everywhere in 2.c
but not in any other file -- does this make things any clearer?
>> So, how is this static variable in 1.c printed here??
What happens when the preprocessor processes your #include "1.c"
directive that you have in 2.c
?
>> It compiles but it won't run.
It doesn't compile cleanly though, GCC spotted a number of things ..
\main.c:16:6: warning: no previous declaration for 'enter_params'
\main.c:40:6: warning: no previous declaration for 'mapping_addr'
\main.c: In function 'mapping_addr':
\main.c:49:6: warning: declaration of 'rep' shadows a global declaration
\main.c:6:5: warning: shadowed declaration is here
\main.c:54:2: warning: too many arguments for format
\main.c:66:3: warning: format '%d' expects type 'int', but argument 2 has type 'int *'
\main.c:66:3: warning: format '%d' expects type 'int', but argument 3 has type 'int *'
\main.c:121:3: warning: format '%d' expects type 'int', but argument 2 has type 'int *'
\main.c:121:3: warning: format '%d' expects type 'int', but argument 3 has type 'int *'
\main.c: At top level:
\main.c:135:6: warning: no previous declaration for 'print_pt'
\main.c: In function 'print_pt':
\main.c:145:3: warning: format '%d' expects type 'int', but argument 2 has type 'int *'
\main.c:145:3: warning: format '%d' expects type 'int', but argument 3 has type 'int *'
\main.c: At top level:
\main.c:150:6: warning: no previous declaration for 'quit_prog'
\main.c: In function 'main':
\main.c:184:1: warning: control reaches end of non-void function
\main.c: In function 'mapping_addr':
\main.c:63:7: warning: 'i' is used uninitialized in this function
\main.c:64:13: warning: 'pf' may be used uninitialized in this function
\main.c:123:5: warning: 'rep' may be used uninitialized in this function
>> why this doesn't work correctly?
The input stream has the skipws
format flag set, use noskipws to clear the flag.
I just did a ctrl+f in notepad when I opened the .lib file and it couldn't find the text 'KeyValue' would this mean they're not being exported?
No.
Rather use dumpbin, see its /LINKERMEMBER option.
You are given two integer numbers: the base a (0 <= a <= 20) and the index b (0 <= b <= 2,147,483,000).
...
if(a!=0 || b!=0)
{
...
What will your program do when both a
AND b
are zero?
Use comparison ( ==
) instead of assignment ( =
) in your if-statements.
but I get an assertion failure, "string iterators are incompatible"
Are you really sure that std::find_if(...)
is failing? I'd imagine that the next line (35) would cause the failure -- it
being invalid at that point.
I did it. Alright, I got it to work with only one loop, but can you tell me why in my output tags2 is reading 18 data sets when it is only supposed read 10.
Hint: 8 + 10 = 18
I just tried making the routine have a return value and no args and it works.
Then I tried adding in one argument and it fails, so it looks like the problem is with the arguments, not the return value.
This suggests mismatched calling conventions (C# is assuming Stdcall, whereas your export is Cdecl).
The following import probably works in your case:
[System.Runtime.InteropServices.DllImport("testsub.dll",
CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern int addit(int a, int b);
...Here is the code causing the app crash:
string ReadLine() { getline(file, lineread); if (lineread.find_first_of("WSF_") != string::npos) { return lineread; } }
The function is basically badly broken -- what will it 'return' if lineread.find_first_of("WSF_") == string::npos
?
Aren't you getting any compiler warnings?
>> Thread ID of the window (what im currently looking to get
So, if you want to know the window's thread identifier then you could give this a try
#include <windows.h>
#include <tchar.h>
int main()
{
HWND hW = FindWindow(_T("MSBLWindowClass"), _T("Windows Live Messenger"));
if(hW != NULL)
{
// Process identifier.
DWORD PID;
// Thread identifier.
DWORD TID = GetWindowThreadProcessId(hW, &PID);
// ... use PID/TID here ...
}
}
Note that i
is incremented at line 10
m=b[i++];
Basically, the compiler ends up seeing e.g. triangle_main.cpp (roughly) as follows
class Triangle
{
public:
Triangle( double, double, double ) ; //constructor initializing the 3 triangle dimensions
void calculateDimensions( double, double, double ) ; //assigns dimensions
//int getTriangle( ) ; //get the value of the dimensions
void printDimensions( double, double, double ) ; //print dimensions
private:
double side1 ;
double side2 ;
double hypotenuse ;
} int main( ) // <--- apparently, this will not work
{
Triangle rightTriangle( 1.0 , 1.0 , 1.0 ) ; //create Triangle object
return 0 ;
}
z:\in common folder 24_09\programming\exercises deitel and deitel\ex 5.20 p242\triangle_main.cpp(7) : error C2628: 'Triangle' followed by 'int' is illegal (did you forget a ';'?)
Your compiler is making an 'educated guess' -- you need to terminate the class Triangle
definition with a semicolon.
The function "getinput();" is a prototype function.. But prototype functions work wonders.. especially in situations like these!
I'm guessing that triumphost meant to say function prototype
You seem to be missing a semicolon ..
class CGame
{
...
} ; // <--- add semicolon
Can anyone provide me with a link to how to create and read from ini files.
You might read up on the GetPrivateProfile...()
and WritePrivateProfile...()
functions, see Registry Functions
Include <windows.h>
#include <windows.h>
#include <mysql/mysql.h>
...
>> That works, to a point. Things got pretty ugly, though, when I added the old ...
>> ... I only want the #define type statements to pre-process, not the #include.
Perhaps you'd like to 'guard' your #include
s with #ifdef
s, like so ..
// foo.cpp
#ifdef VERNON_COMPILES
#include <iostream>
#endif
int main()
...
Pre-processing would be:
g++ -E foo.cpp
and compiling would be:
g++ -D VERNON_COMPILES foo.cpp
Something spotted .. what's up with line #1057
for(int j=5; j<-1; j++)
?
>> There has been an improvement. It runs a few seconds faster ...
Console output is slow, you might simply delete the line
cout << "a " << a << " b " << b << endl;
altogether.
>> But I am still a bit confused why did it work on old Turboc compilers.
>> The error is:
>> unable to establish existance of the account specified task scheduler.
>> While calling pIPersistFile->Save(NULL, TRUE) method it is throwing an error.
A quick test on XP shows that this error (upon pIPersistFile->Save()
) occurs when either;
Are you absolutely sure you are using valid username & password?
Note that even if I supply a non-existing username, the task is created and when viewed via the Task Scheduler, the currently logged-on user's name has automagically appeared in the Run As -field (which is quite surprising).
Hmm, I see you've marked this thread as solved, but anyhow ..
>> The prog works - but I want to be sure
This far I've gathered that your program goes like the following ..
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
HANDLE ghMutex = CreateMutex(
NULL, // default security attributes
TRUE, // initially owned
"AnyName"); // named mutex
if (GetLastError() != ERROR_ALREADY_EXISTS )
{
// I think this is the first instance ...
try
{
Application->Initialize();
// <snip>
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
CloseHandle(ghMutex);
return 0;
}
else
{
// I think this is NOT the first instance ...
Application->Terminate();
}
return 0;
}
To test your program's behaviour, use the below console program, i.e. launch this program first and then begin launching new instances of the main program -- will the instance detection still work?
#include <iostream>
#include <windows.h>
int main()
{
// Create an event (the name used here must match the name of your mutex)
HANDLE hEvent = CreateEvent(0, FALSE, FALSE, "AnyName");
if(hEvent)
{
std::cout << "Event handle: " << hEvent << std::endl
<< "Now, start multiple instances of your main program ..." << std::endl
<< "Press Enter to exit.";
std::cin.get();
CloseHandle(hEvent);
}
else
{
std::cout << "Unable to create event, error: " << GetLastError() << std::endl;
}
}