Search Results

Search: Posts Made By: cyler
Forum: Programming 06-11-2010
6,118
Posted By cyler
Yes, it seems gedit does not count the bytes...
Yes, it seems gedit does not count the bytes correctly (and me neither). strlen states 6 bytes.
Forum: Programming 06-10-2010
6,118
Posted By cyler
Valgrind error
I get this Valgrind error while using malloc but if I use calloc then there is no error.

I allocate 8 bytes for the string inside sprintf, 12 for the ip and 1 for the string terminator. This...
1,747
Posted By cyler
Compile most recent kernel on older distro ?
Debian lenny uses the 2.6.26 kernel by default. Can I compile the most recent kernel from kernel.org and use it instead ? Will the new kernel be incompatible with other installed softwares ?
22,364
Posted By cyler
-c will not work. I have an old sudo version ? ...
-c will not work. I have an old sudo version ?

user1@debian:~$ sudo -u user2 -H -c "ulimit -S -c unlimited"
sudo: illegal option `-c'
usage: sudo -h | -K | -k | -L | -l | -V | -v
usage: sudo...
22,364
Posted By cyler
sudo + ulimit not working ?
When I use sudo with ulimit there is an error but if I use ulimit without sudo there is no error.

In bash:

user1@debian:~$ sudo -u user2 -H ulimit -S -c unlimited
sudo: ulimit: command not...
Forum: Programming 06-01-2010
2,364
Posted By cyler
I am trying to follow this article:...
I am trying to follow this article: http://www.w00w00.org/files/articles/heaptut.txt

This article's example successfully uses memset to overwrite a pointer's address while making it overflow to...
Forum: Programming 06-01-2010
2,364
Posted By cyler
Pointer addresses in multiples of 32 ?
1. Why are the pointers' addresses every 32 ?
2. Am I correct in stating that memset is writing to memory that is not allocated to any of the 3 pointers ? Is it writing to memory in between the...
Forum: Programming 04-27-2010
3,329
Posted By cyler
=== SHARED === I have successfully linked...
=== SHARED ===
I have successfully linked ld-2.7.so by compiling like this:

gcc -std=c99 -D_POSIX_C_SOURCE=200112L -O2 -m32 -s -Wl,-dynamic-linker,ld-2.7.so myprogram.c

But I have not managed...
Forum: Programming 04-27-2010
3,329
Posted By cyler
shared libs
The gcc version is different on my computer than on the remote computer. An ldd on my program says:


Is there any way I can tell gcc to compile my program against my version of libc-2.7.so and...
Forum: Programming 04-18-2010
13,846
Posted By cyler
Ah, that's why. I thought it would only apply to...
Ah, that's why. I thought it would only apply to the program being compiled.

By default, yes, because in ASCII, 1 char = 1 byte, but making it equal to 32 bits (4 bytes) would be better suited for...
Forum: Programming 04-18-2010
13,846
Posted By cyler
strlen for UTF-8
My OS (Debian) and gcc use the UTF-8 locale. This code says that the char size is 1 byte but the size of 'a' is really 4 bytes.
int main(void)
{
setlocale(LC_ALL, "en_US.UTF-8");

...
Forum: Programming 04-11-2010
3,805
Posted By cyler
Also, I would like to know if fopen, fread &...
Also, I would like to know if fopen, fread & fwrite are thread-safe ? Can multiple users fopen, fread & fwrite files at exactly the same time with no problems or is that the whole point why fcntl.h...
Forum: Programming 04-10-2010
3,805
Posted By cyler
Yes, thank you, it is good to know that you can...
Yes, thank you, it is good to know that you can get file attributes even if the file is locked. I was not aware of access().
Forum: Programming 04-10-2010
3,805
Posted By cyler
Open function of sys/stat.h
If a process already has the entire file locked for read and write using newstruct.l_type = F_WRLCK; what would happen if another process would try to open it in read only mode using open(filename,...
Forum: Programming 04-01-2010
8,234
Posted By cyler
Thank you. Suggestions worked.
Thank you. Suggestions worked.
Forum: Programming 03-31-2010
8,234
Posted By cyler
socket function to read a webpage (socket.h)
Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct...



#include <stdio.h>...
Forum: Programming 03-19-2010
4,211
Posted By cyler
wchar_t
1. Can anybody tell me why this outputs: Ros? (My locale is: en_US.UTF-8 and I'm using gcc)
2. I need wchar_t if I want to use chars with accents ?
3. Can I use UTF-8 with wchar_t ?


#include...
Forum: Programming 03-18-2010
6,629
Posted By cyler
According to Valgrind, your code has a memory...
According to Valgrind, your code has a memory leak:

==31733== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 1)
==31733== malloc/free: in use at exit: 15 bytes in 3 blocks....
Forum: Programming 03-17-2010
6,629
Posted By cyler
malloc vs realloc
Why when using realloc, john is reversed 3 times but not the other 2 names ? But if I use malloc, then the 3 names are reversed correctly ? (but then there is a memory leak)

How can I reverse all...
Forum: Programming 03-15-2010
3,039
Posted By cyler
Thanks. Yes, actually according to the man page,...
Thanks. Yes, actually according to the man page, %i has a different meaning according to the context. Therefore, just use %d instead.
Forum: Programming 03-15-2010
3,039
Posted By cyler
using sscanf
How can I separetely extract the string and int after "dribble" ? (sscanf must limit TEXT to 9 chars to avoid buffer overflows.)

How come this code does not work with "dribbletext08" but does with...
Forum: Programming 02-11-2010
3,611
Posted By cyler
Ok, I finally got it. original[2] is an...
Ok, I finally got it.

original[2] is an ampersand but replacement[2] also has an ampersand. So what was happening was that the while loop was replacing the replacement as well.

Solution:
move...
Forum: Programming 02-10-2010
3,611
Posted By cyler
char original[15][7] = { "\u00E7"/*ç*/, "\"" ...
char original[15][7] = { "\u00E7"/*ç*/, "\"" , "&" ...
Forum: Programming 02-10-2010
3,611
Posted By cyler
I tried to compile it explicitly stating UTF-8: ...
I tried to compile it explicitly stating UTF-8:
-std=c99 -finput-charset=UTF-8 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-8

I tried using Hex codes as you suggested but only Unicode codes are...
Forum: Programming 02-09-2010
3,611
Posted By cyler
char problem ?
Here is a C function that replaces some non-ASCII chars to html decimal entities. It seems that the char "ç" does not get replaced correctly but the rest do. Any idea why this is happening ?

(Please...
Showing results 1 to 25 of 35

 
All times are GMT -4. The time now is 05:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy