- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
3 Posted Topics
Nice code everyone! It's funny - I just had to do the same thing for a class the other day in school. I uploaded the code to my blog... here it is: <URL SNIPPED> Also here: [CODE]int bin2dec(char * binstr) { int dec = 0; int len = strlen(binstr); int …
If you only need support for Linux, you can try using this: [code=c] /* Creates a file named "helloworld.txt" in the current directory and sets access permissions to read-only for group */ #include <stdio.h> #include <sys/stat.h> char *myfile = "helloworld.txt"; char text[] = "hello"; int main() { FILE *fp; fp …
Your data will not be overwritten, as gerard4143 said. If you would like to see for yourself, try this code: [CODE]int main() { char *pointer = "hi"; char *oldaddr = pointer; /* backup pointer */ printf("%X%s", pointer, "\n\n"); pointer = "weeeeeeeeeeeeeeeeeeeeeee"; printf("%X%s", pointer, "\n\n"); pointer = oldaddr; /* restore old …
The End.
taylorg