Use a library like GMP.
Type: Posts; User: ^xor
Use a library like GMP.
Use strtok.
I'd use it if I had Windows, but I can't stand the look and feel of QT in Linux. Firefox 1.5 Beta is just as fast as Opera for me anyway.
You forgot to close the comment on line 178... A good editor would've picked it up instantly as the rest of the code would be colored in the comment color.
Getting and searching for matching song information is easy, but queing up the song in your MP3 player could prove difficult unless it has a good command line interface or similar. It's not...
Yes, but it will change if you do something like this instead:
signed int array1[10];
signed int *array_ptr = array1;
cout<<&array_ptr<<endl;
...
char string[] = "I_like_peanuts!";
char *p = string;
for (; *p; ++p)
{
if (*p == '_')
*p = ' ';
}
Read the FAQ perhaps?
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044873249&id=1043284392
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
if (NULL == 0)
puts("TRUE: NULL == 0");
if ('\0' == 0)
puts("TRUE: '\\0' == 0");
Never use scanf like that. What do you think happens if someone decides to input 200 characters instead of 31 + nul? That's right, a stack overflow...
Either use scanf("%31s", ...) or fgets.
It's gets() and not get(), and I haven't looked closely at your code so I don't know if that's what causing it to break. But the mere presence of it in your code means that your program has a...
scanf("%s", name);
You've got yourself a buffer overflow there. Use fgets or add a lenght modifier like %99s or something.
Didn't anyone tell you to never ever use gets()?
But why should you when it's not necessary and simply introduces another point of failure? The reasons for not casting malloc may be weak according to you, but can you give us a single good reason...
Did you link against the X and motif libs? -lMotif and -lX11 or something similar.
gcc -E
char tin[2];
...
sprintf(tin,"no\0");
You're still writing past the array boundary.
while(tin == "yes")
That's not how you compare strings. Use strcmp or strncmp. Furthermore, tin can never be "yes" since it's only got room for one character plus the nul character. Either make...
I just read that extern char **environ is defined by POSIX while envp (third arg to main) is just something that a lot of implementations support.
What's the difference between environ and envp? They both seem to do the same thing...
environ
#include <stdio.h>
#include <unistd.h>
extern char **environ;
int main(int argc, char...
8 space tabs all the way. Indentation is meant to make the code more readable, and IMO 4 spaces just isn't enough.
I also prefer tabs over spaces since it consumes less space (not a big issue...
That will work. Salem's point before was that when you assigned the a pointer with a string literal, you lost memory location of the memory you allocated with malloc. Trying to free that now with a...
A quick google search turned up this document:
http://www.fileformat.info/mirror/egff/ch09_04.htm
Just search for "bit order" within it to see lots of references to different bit orders.
This is quite confusing...
So if I have received an integer as little endian, on a big endian machine (with big endian bit order), I can't use htonl to convert it to network endian?
As for the...
Ah right, so 'up' moves up one stack frame? That's good to know. :)