How access a specific memory portion through printf() function????
Hi friends,
Hope everyone is doing well. Please have a look at this simple program, you will figure out what I want.
What should I write instead of ??? to access the data that I just stored in that particular memory location???
Here is another program which works, but not the way I would want.
Is it possible to read data from a specific memory address directly, without creating any pointers???
Looking forward to your helpful replies!
Thanks in advance!
Here is the code I'm using
{
printf("%11d %4.2f\% %4.2f\%\n", $1,$2,$3);
}
I want the output to look something like
1235415234 12.24% 52.46%
Instead it looks something like
319203842 42.27\%4.2f\%
How do I just print a "%" without awk or printf thinking I'm trying to do... (1 Reply)
I use FreeBSD,and use signal,like follows:
signal(SIGHUP,sig_hup);
signal(SIGIO,sig_io);
when I run call following code,it can run,but I find a puzzled question,it should print some information,such as printf("execute main()") will print execute main(),but in fact,printf fuction print... (2 Replies)
I have a file which contains data like
a
b
x
col1:data1
formula:data3
this is for 2
a
c
col1:@bkw
formula:dontad ad
asd
as per
a
\
i want the data from col1 and formula to keep the col1 data in left side of excel and col2 data in right side of it (1 Reply)
I'm looking to get the file cache portion of physical (real) memory on a Solaris workstation (Similar to the Cache: line in /proc/meminfo on some Linux systems):
# swap -s; swap -l; vmstat 2 2; echo "::memstat" | mdb -k
total: 309376k bytes allocated + 41428k reserved = 350804k used,... (5 Replies)
Hi,
I have the following text file:
8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm
9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm
10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm
11 T1mapping_flip15 ok 128 108 30... (2 Replies)
hey all, im a new programmer.
i was wondering how you would go about writing the printf function yourself? it is my understanding that when you call printf you are calling an already written function and just providing an argument? if this is the case, is it possible to write that function... (8 Replies)
Hi Gurus,
I'm using HP-UX B.11.23 operating system.
I've been trying to extract a specific wording for example: "A tool used by tp produced warnings" from my below log data, but could not find a way to solve it. My intention is, if the log contain the word: "A tool used by tp produced... (9 Replies)
Hello,
I am trying to read from a file using PERL:confused, however i need to read specific portions of the file
the file goes like this
<Name 1
Hono
<Name 2
Jack
and so on
anyways i need to be able to write a program that ONLY opens the lines beginning with "<"? so it would... (2 Replies)
#include<stdio.h>
int counter;
int fibonacci(int n)
{
counter += 1;
if ( n <= 2 )
return 1;
else
return fibonacci(n-1) + fibonacci(n-2);
}
int main(void)
{
int i;
int sum ;
for( i = 1 ; i<= 10; i++)
{
counter = 0;
sum... (1 Reply)
Discussion started by: vincent__tse
1 Replies
LEARN ABOUT CENTOS
edata
END(3) Linux Programmer's Manual END(3)NAME
etext, edata, end - end of program segments
SYNOPSIS
extern etext;
extern edata;
extern end;
DESCRIPTION
The addresses of these symbols indicate the end of various program segments:
etext This is the first address past the end of the text segment (the program code).
edata This is the first address past the end of the initialized data segment.
end This is the first address past the end of the uninitialized data segment (also known as the BSS segment).
CONFORMING TO
Although these symbols have long been provided on most UNIX systems, they are not standardized; use with caution.
NOTES
The program must explicitly declare these symbols; they are not defined in any header file.
On some systems the names of these symbols are preceded by underscores, thus: _etext, _edata, and _end. These symbols are also defined for
programs compiled on Linux.
At the start of program execution, the program break will be somewhere near &end (perhaps at the start of the following page). However,
the break will change as memory is allocated via brk(2) or malloc(3). Use sbrk(2) with an argument of zero to find the current value of
the program break.
EXAMPLE
When run, the program below produces output such as the following:
$ ./a.out
First address past:
program text (etext) 0x8048568
initialized data (edata) 0x804a01c
uninitialized data (end) 0x804a024
Program source
#include <stdio.h>
#include <stdlib.h>
extern char etext, edata, end; /* The symbols must have some type,
or "gcc -Wall" complains */
int
main(int argc, char *argv[])
{
printf("First address past:
");
printf(" program text (etext) %10p
", &etext);
printf(" initialized data (edata) %10p
", &edata);
printf(" uninitialized data (end) %10p
", &end);
exit(EXIT_SUCCESS);
}
SEE ALSO objdump(1), readelf(1), sbrk(2), elf(5)COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2008-07-17 END(3)