Greetings,
First of all: use code tags:
void main(){
struct mystruct *pdemo; /* You forgot the '*', typo? */
/* Also, at this point the compiler does not know about 'alloc_mystruct'...
Type: Posts; User: augur
Greetings,
First of all: use code tags:
void main(){
struct mystruct *pdemo; /* You forgot the '*', typo? */
/* Also, at this point the compiler does not know about 'alloc_mystruct'...
Greetings,
Get DJGPP, it's free and Allegro supports it.
Greetings,
Try: System.Environment.GetCommandLineArgs()
Greetings
Nope. Only the functions you actually use in the program are actually linked to the finall .exe.
Greetings,
I don't know what's wrong with the time functions, it works perfectly here. I'm using MS VC7 compiler, but the code is pretty standard, i think!
Are you sending every keypress on the...
Greetings,
For the IP part try:
inet_ntoa(client.sin_addr);
'inet_ntoa' takes the structure as a parameter not the '.s_addr' member of the structure.
Here's an example for the date/time...
Greetings,
c-strings faster than std::string? I doub't it, std::strings will often be as fast as c-strings and in some circumstances even faster. They become less efficient when frequent...
Greetings,
In that case I'm sorry, but what I got from 7stud's post was not that <string.h> isn't there, but if you are coding C++ you should be using the Cname header instead, i.e: <cstring> and...
Greetings,
The thing is, if you are using <iostream> you should use <cstring> if you are using the old C string routines. <string.h> is only in the standard for the same reason <iostream.h> is:...
Greetings,
C++ is all about classes! Besides, structs are classes in C++, the only difference (apperently) is that in struct's the members default to public where in classes it defaults to private.
Greetings,
But i bet you can make your own functions.
Anyway, here's an example on how to find a string inside another:
#include <iostream> // This is the standard header. 'iostream.h'...
Greetings,
Don't mix C++ standard headers with the non-standard/deprecated headers. "iostream.h" is deprecated, the standard header is "iostream", and please do use the code tags, it makes it much...
Greetings,
There is no full-proof method of protecting the access to your PC, if one has phisicall access to it, one can do anything.
BIOS is no good, anyone can break that.
One way of making it...
Greetings,
std::string also has the '=' operator defined that you can use like:
#include <iostream>
#include <string>
int main
{
Greetings,
Elaborating on thenrkst's ideia, and if speed is not that important you can avoid bitwise operators alltogether:
#include <iostream>
typedef unsigned char byte;
typedef unsigned...
Greetings,
Actually
std::ifstream ifs("a:/data/gradefile.txt");works just fine in windows.
One thing, to convert a vector<char> to a string:
std::string myString(myVector.begin(), myVector.end());
// or on an empty string:
myString.insert(myString.begin(), myVector.begin(),...
#include <iostream> // std::cout, std::endl
#include <iomanip> // std::setprecision
int main()
{
double d = 1234.56789;
std::cout << d << std::endl; // output: 1234.57;
std::cout...
Hi,
Dynamic arrays have to be allocated with the 'new' operator or the 'malloc' function.
ifstream infile("text.txt");
infile >> numrecords_str;
numrecords = atoi(numrecords_str);
Well, there was an error with my 'to_int' function, as Codeplug pointed out. Try this:
int to_int(const string& val)
{
int number;
istringstream is(val);
is >> number;
...
You are absolutely right about the 'istringstream', my bad!
And I was wrong, again, about 'atoi', it is 'itoa' that is not part of the standart.
Greetings,
I'm no guru but this should do it:
#include <iostream>
#include <string>
#include <sstream>
int main()
Greetings,
That is because 'atoi' is expecting a C string.
There are at least a couple of ways you could do this, first by using the 'c_str()' member of std::string and pass that to 'atoi' like...
Greetings,
'30 + ob' does not work, in this case, because the compiler is looking for an '+' operator wich takes an left operand of type int and a right operand of type X, and there isn't one. ...
Well, if the only thing being converted are int's, then no, templates aren't necessary at all, but still is good to know what your options are, don't you think?
One should aim at making code...