I didn't say that I thought segmentation faults are fine. I just said that I can find and fix them without harming my system.
Type: Posts; User: MTK
I didn't say that I thought segmentation faults are fine. I just said that I can find and fix them without harming my system.
One little project I did involved a lot of dealing with allocated memory and it tried to write to places it wasn't supposed to all the time.
The worst that happened was just a little message in...
This whole conversation reminds me of this quote:
And that's why I think that things like memcpy, etc should NOT be removed. Unlike gets(), they CAN be safe if used right.
I agree that gets() must be gotten rid of. Unless you give it an infinitely large buffer, it's always possible for the user to enter a line longer than the buffer.
Besides, is this:
...
Yeah, that's correct. Without the "!= EOF" part it checks if it's not 0 instead of not EOF (probably -1).
And as you see the assignment operator can be used within an expression! It assigns the...
BAD!!!
You cannot use a "char" because each byte in the file fills a whole "char". How do you think the EOF can be represented then? You have to use an int instead. It's filled with the values...
I have almost the exact same problem.
I really suck at reading other people's code :(
I guess that malloc() is the only reasonable way, as far as I can think of.
Another idea might be to use fixed-size char arrays in the structs, but that means that there will be a needless...
I know, and I would never use NULL for anything but pointers.
I was just trying to explain it to the original poster that the concepts of "NULL" and "void" are completely unrelated.
NULL == 0. Think of it this way:
#define NULL 0
After running this code:
int var;
var = NULL;
"var" will contain "0".
Here's a better example:
struct datafile {
char *str1;
char *str2;
int number;
linkedlist *list;
}
What would be the best way to fill in a struct with data from a file?
Here are my two main proplems:
1) How to parse the data out of the file?
It will be in this format:
<attribute>...
Haven't noticed that. :)
I wrote this:
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
int main()
{
DIR *dir = opendir(".");
It should be C:\\>.
\n - newline
\t - tab
\\ - backslash
This works, it lists all the files in the current dir:
#include <stdio.h>
#include <dirent.h>
int main()
{
DIR *dir = opendir(".");
struct dirent *dirent;
Cross-platform isn't really necessary, I just thought maybe something existed.
I'll check out opendir().
I would like to be able to do file/directory manipulation in C.
Simple and cross-platform would be great, otherwise it should work in Linux.
I tried searching the wep and looking at some man...
$ g++ -c -lX11 -I /usr/include/cairo -lcairo src/TopLevelWindow.cpp
src/TopLevelWindow.cpp: In constructor ‘TopLevelWindow::TopLevelWindow(Application*, Dimension, std::string)’:...
That reminded me that the python interpreter makes a pretty good calculator too, and you can get history with the up key.
Qalculate! is pretty good.
EDIT: I just got SpeedCrunch to try, it's a very nice concept compared to most calculator applications that try to emulate a physical calculator.
And I saw a pretty...
What? Are you writing code in a word processor?!?!
XGetGeometry might be just what I want. I'll try it later.
It's supposed to be cout!
Xorg in Linux.