@matsp: thx for explaining!
@PrashantVaidwan: hmm I thought I would make just one pointer to a buffer of 20bytes with this...thanks for making this clear
Type: Posts; User: lilcoder
@matsp: thx for explaining!
@PrashantVaidwan: hmm I thought I would make just one pointer to a buffer of 20bytes with this...thanks for making this clear
why not opening another thread????
buff is a pointer in my code and &buff is a memory adress to the content of buff, so both are the same in this case.
you're code arrengement looked horrible to me... Take a look at this: http://irc.essex.ac.uk/www.iota-six.co.uk/c/b4_arithmetic_operators.asp
#include <stdio.h>
int main (void) {
int...
Okay let's take a look at this wrong scanf-implementation:
#include <stdio.h>
int main(void) {
char *buff[20];
scanf("%s",buff);
@salem: Yes, indeed it's limited by hd-speed and with me even more because my HD is full-encrypted. But I think I can get better than cat. Maybe my BUFSIZE isn't that good choosen as I thought...
fputs doesn't seem much faster than printf. It's best result was 4032ticks over 1000 tries..
I'll redo the time-test this night with closed X-server and no network-connection to bypass any...
Hi okay I did a ~60MB Zip-file for this test now.
time cat ind.zip
[..]
real 2m31.340s
user 0m00.000s
sys 2m30.089s
Yes the while loop is a good solution and works really well:
#include </usr/include/linux/unistd.h>
#define BUFSIZE 4092
int main(int argc, char *argv[1]) {
But a line has not definite size or? So a 10 MB file could have just one line and never contain \n ? I think I'm gonna try to accomplish this now with sys_readahead:
But it seems I can't access...
Really? I thought this would be a good way of reading files with unknown length.
Okay I got now behind, that I have to use gcc -pedantic to get these kind of warnings you are telling about.
...
Okay I did now like suggested and a few other things, so I think now there shouldn't be any errors:
#include </usr/include/linux/unistd.h>
#include </usr/include/asm/stat.h>
int main(int...
Hi,
So do I: syscall(__NR_close,fd);
As said this is strlen without including string.h .
I can't follow that? I created a 182kb textfile and have resized my buffers and everything...
ah okay thank you for your answers :)
int *x = NULL; // * used such that x is a pointer.
makes sense
int a = *b; // * used such that *b is an int.
Aha this makes a containing the hexcode of the first field of b[]:
...
Ahh so buffer and &buffer are exactly the same? Because also &buffer points to the first element of this char array.
But is * not the symbol for the pointer-type? And next to that I don't get a...
Ahh thank you I thought FILE would be a fd type or something like this. 3 was really the correct fd. This here is working fine for me:
#include </usr/include/linux/unistd.h>
#include <string.h>...
okay I did so now like I would do the same in assembler:
fd = syscall(__NR_open,myfile,00,04000) ;
in asm I do this an it works:
mov eax,5
mov ebx, myfile
mov ecx,00
mov...
Hi,
I have written the following code:
#include <stdio.h>
int main(void) {
char *myfile = "/home/username/Desktop/testfile";
FILE *fd;
But can the c-lib put features into unistd.h? Isn't that part of the kernel?
I'm really starting to get ........ed of by Ubuntu...
greets
Could you point me to a good linux coding forum for advaced topics?
lol I know how to use grep... I just posted the whole file in order not to get answers telling me to look closer, or I overlooked them. They are not here.
Really noone any idea?
No they are not here:
cat /usr/include/asm-i386/unistd.h
#ifndef _ASM_I386_UNISTD_H_
#define _ASM_I386_UNISTD_H_
/*
* This file contains the system call numbers.
*/
Hi,
$ cat /usr/include/linux/unistd.h
#ifndef _LINUX_UNISTD_H_
#define _LINUX_UNISTD_H_
/*
* Include machine specific syscall numbers
*/
Well in the IBM-paper is written:
but they are not defined in unistd.h here. In syscall.h they are also not:
$ cat /usr/include/sys/syscall.h
/* Copyright (C) 1995, 1996, 1997 Free...
Hi Salem,
my kernel: 2.6.20-16-386
my compilersuite: gcc (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
bye