Programming :: Access/Print A C Variable "as It Is Stored In The Memory"?

Oct 23, 2010

I would like to access/print a C Variable of any type "as it is stored in the memory". I would expect the output to be an array of bits. Whats the simplest/shortest way to do that?

View 14 Replies


ADVERTISEMENT

Programming :: C: How Is A String Array Stored In Memory

Jan 12, 2009

I need to call a function that takes a string array as argument, declared like this:Code:int someFunction(/* some parameters... */, const char* s[]);I'd like to know how to allocate memory for the string array. I know a string is an array of chars and an array is a pointer to the first element, then a string array should simply be a two dimensional char array. But is it a single memory block where all strings are stored consecutively?? Or is it a base vector where each element is a pointer to a separate memory block that contains a single string?More specifically: should I malloc() a single memory block large enough for all the strings? or should I allocate separate blocks for each string plus an extra one for the base vector?

View 5 Replies View Related

Programming :: Print Variable Value In Awk?

May 16, 2011

problem statement:

pattern_search="Exam Name"
sed -n "/$pattern_search/,/hello/"p tmp5 | awk '{if ( $4 != 0 && $4 ~ /[0-9]+.*[0-9]*/ ) print "$pattern_search" " " $0 }'

"tmp5" is a file. this is printing output as

$pattern_search value1

i.e value of $pattern_search is not getting substituted. i am expecting output as

Exam Name value1

View 3 Replies View Related

General :: Does The Output Of The Previous Command Get Stored In Any Variable

Mar 26, 2011

For example, when using bash you can use

Code:

to execute the previous command or

Code:

!<number> to execute the Nth command(use history to see the list). Or you can use

Code:

cd !-2:1

to cd into the value in the first field that was executed 2 commands ago Anyhow, say I run a command and the output is a path. Any way to cd and then some variable where OUTPUT of the previous command was stored? A variable that always stores the OUTPUT of the last command.

View 8 Replies View Related

Programming :: How To Do A Direct Memory Access

Jul 26, 2011

I have a single board computer previously running DOS. I recently made Linux running on it. Now that the system is running Linux, I have to translate the code that was supported by DOS. The code has segments that allow direct access of memory mapped registers through the macro _MK_FP and do read/write. I have read that where DOS allows this kind of direct memory access, Linux does not. Is there a way to do this in Linux?

View 6 Replies View Related

Ubuntu :: BASH Quote - Calling Commands Stored In A Variable?

Feb 19, 2010

I am having some weird problems with calling commands stored in a variable (I need to do this to assemble a command with a bunch of parameters automatically and then execute it).Example code that will replicate the weirdness:

$ echo "hello world" > "test file.txt"
$ cat "test file.txt"
hello world

[code]....

I would expect the output to be:

hello world

What happens to the quotes? I have tried various combinations of single quotes, escaped quotes, etc, but it seems like quotes in a variable are not evaluated as quotes when that variable is executed.

View 9 Replies View Related

Programming :: Access In-memory Structure And Its Members?

Dec 13, 2010

I am implementing c program to access ext3 file system's metadata. I want to know how to access members of the in-memory superblock structure. I am able access on-disk ext3_super_block structure but dont know how to access in- memory structure and its members.

View 1 Replies View Related

Programming :: Access Another Process's Memory With A Twist?

Jul 31, 2010

I have been looking for a method for a while now that would allow me to access another process's memory without causing it to freeze. But with all of my googling I have found nothing

so, my question is: Is there a way to not lock a process while accessing it's "/proc/[PID]/mem" interface?

View 3 Replies View Related

General :: Bash: Substitute Parameter In A Quoted String - Stored In Another Variable

Jan 31, 2010

(variable substitution?)
(parameter expansion?)
Code:
run_repeatedly()
{
NUM=0
while [ <irrelevant stuff here> ]
[Code]....

run_repeatedly "programX -o "./messy/path/output-$NUM.txt"" The echo inside the loop prints "...-$NUM.txt"; obviously I'm aiming to have bash substitute the iteration number so that I end up with many output files not 1.

View 5 Replies View Related

Programming :: Gdb Reports - Cannot Access Memory At Address 0x8049088

Jul 11, 2011

Kernel 2.6.21.5, slackware 12.0
nasm 2.03.01
ld 2.17
GNU gdb 6.6

This GDB was configured as "i486-slackware-linux".

Code:

What could the cause of the message output by gdb possibly be? Reading some tutorials, I've learn the flat memory model is used in linux. So, in particular, I needn't care about the DS segment register.

Also, line 7 in the listing above, suggests nasm is assuming 32-bit addressing and so, I think it is using the flat memory model.

View 3 Replies View Related

Ubuntu :: Know Where The Installed Applications Are Stored And How Much Memory They Occupy

Sep 25, 2010

I have installed ubuntu 10.04 using wubi installer..I am dual booting ubuntu with windows 7.I have alloted 8 gb of disk space while installing ubuntu.My first question is how can i know where the installed applications are stored and how much memory they occupy and how much free space is available out of the alloted 8gb.?My second one is now i have to install RAD 7.5 which requires 3.5 gb of free space..How can i expand the disk space without the need of reinstalling ubuntu.

View 3 Replies View Related

Programming :: Bash - Read Content Of File To Variable And Use This Variable In For Loop ?

Aug 21, 2009

I'm trying to read content of file to variable and use this variable in for loop. The problem is, when I have c++ comment style in file - /*. Spaces in line are also interpreted as separated lines.

For example:

Code:

Changing $files to "$files" eliminate these problems but causes that whole content of variable is treated as one string (one execution of loop).

View 6 Replies View Related

Programming :: Make A New Variable With The String From The Old Variable Btut Without Any Plus Sign?

Apr 7, 2010

my script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.

i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't

foo=+12.40
bar=${foo#+}

View 4 Replies View Related

Programming :: Access The "page" Variable Inside The Script To See What Args It's Been Given?

Apr 16, 2010

I have a PHP script which will show info from 5 lines in a MySQL database, with a "next" button to show the next 5 lines and so on. Initially it'll get called with a ?page=1 in the args in the URL, and then onward I want the "next" button to link to the same script , but with a ?page=2 in the args. First of all, how can I access the "page" variable inside the script to see what args it's been given? (sorry, extremely newbie question here )

And secondly, what will the code for the "next" button look like? If the script is called "seenames.php", I want this: print "A HREF="...cgi/seenames.php?page=$page+1">Next</A> , if you get my meaning. But what will the quoting for the above line be? I'm sure I've got it wrong.

View 2 Replies View Related

Programming :: Search Within A Variable And Assign The Results To A New Variable?

Apr 25, 2011

how I can search within a variable and assign the results to a new variable. I'll use the following as an example -

cars="Audi BMW Cadillac Chevy Dodge Ferrari Ford Mercedes"
list=`echo ${cars} | egrep -o '<A?+|<C+'`

with the echo command I get the following output assigned to list -

A
C
C

What I'd like to get for output is -

Audi
Cadillac
Chevy

how I could do this regardless of upper/lower case letters?

View 5 Replies View Related

General :: Awk Does Not Print The Value Of The Variable As Expected

Apr 4, 2011

I have this simple awk program but it not prints var_cab whe^E or ^S or ^M after he finds the second ^C

/^C/ { var_cab = substr($0,1,28); ent = 0 ; print "estoy en cabecera" var_cab;}
/^E/ { if ( ent ==0 ) var_fech = substr($0,4,8) ; ent ++;
print var_cab var_fech $0; }
/^S/ { print var_cab var_fech $0; }
/^M/ { print var_cab var_fech $0; }
END { print var_cab,ent}

the input file is many lines like this, every new block stats with ^CAB

CABES3000088888880000007EAMB
ENT20090706D060709-888 0028560000000012VALLE CA'ZULIA5501, 5502, 5498 y 5535
SAL201008250000134900000321V1202935-MU

[code]....

View 4 Replies View Related

Programming :: Assign Value Of C Variable To Shell Variable?

Apr 28, 2010

included shell script inside c program, and i wanted to assign the value of c variable to shell variable..Can any one please suggest me how to do it?

View 8 Replies View Related

Server :: Where Is The Spool File Stored When A File Is Sent To Print In Cups

Oct 28, 2010

I'm trying to setup a print server in Fedora 13. I've made it using CUPS and when I send something to print from a Windows PC it goes ok. My main concern is to know where is the spool file stored when a file is sent to print. I've seen in many forums that it is stored in /var/spools/cups. What I only see here is a file name c000XXX with some information about the printing job. I'm using hold print for this printer and before printing out anything I can't find the spool. I've tried cups-pdf and it stores a pdf file in a route but this is not enough for me. I need to know where the spool data is stored in order to know from who is the job being send.

View 1 Replies View Related

Ubuntu :: Need To Access Stored Files After Disaster

Jan 4, 2011

I am new to Linux. I was running Ubuntu 10.04. While downloading software, one of my downloads changed changed my OS to Xubuntu. From browsing the available software, I surmised(wrongfully it turned out) that files starting were X files. In Synaptic, I deleted all files starting with X. This I found is a form of hari kari. When I boot up now, I have a choice of straight to Ubuntu or "Help" mode. If I boot up straight, I get to Ubuntu logo and it hangs up running the dots between red and green and I give a warm boot to restart. If I choose the "Help" route, I go thru what a windows user would call DOS commands or activity. At the end of whatever it is doing, it asks for user ID and password. I give it those and I am given a command line. I don't know what to do with this. I would like to access my stored files and save them. If nothing can be done to save them, I will just start over by reinstalling 10.04. BTW I am running 7.1 from an old boot disc. Is there some way that I can retrieve my files?

View 8 Replies View Related

Programming :: Access At Physical Address - I/O Address In My Map Memory?

Dec 17, 2008

When I try to access at physical address (0xD0000), we known that it is necessary to convert physical address to virtual address using function IOREMAP(0xD0000, 1024) and return me 0xC00D0000.

Now our doubt is when I have a board with I/O in address 0x150, is it necessary to convert this address to other virtual address??? or with inb(0x150) return me state of I/O in this address? How can I known where is this I/O address in my map memory?

View 7 Replies View Related

Programming :: Memory Leaks - Glibc Detected - ./SuffixTree: Malloc() - Memory Corruption - 0x00

Mar 21, 2011

I am new to C and linux. My code below does arbitary writes but I cant figure out where or how it does it.

I am calling the insertNode() function with seq = 'MISSISSPPI$' and alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ$'

Code:

Weird behaviour I should mention is that when I check for NULL pointer in node->child[index], the unassigned values are not null anymore, they point to arbitary memory.

View 12 Replies View Related

Programming :: Write A Script That Can Show Me Total Memory Vs Used Memory?

Apr 13, 2010

How do I write a script for my Linux that can show me total memory vs used memory and have it email me results if it's over 70 percent?

View 2 Replies View Related

Programming :: Assignment To A Variable Variable?

Mar 17, 2011

This loop is part of a bash script which takes multiple arguments.

Code:
for ((i=1;i<=$number;++i)) ; do
offset=$(($i+5))

[code]...

View 3 Replies View Related

Programming :: SHM Memory Counted As Cache Memory With Kernel 2.6.18?

Aug 25, 2010

Is that possible that SHM shared memory is counted as cache memory on Linux with kernel 2.6.18?If find it really odd since this memory is not file backed, but I have a piece of code that loads data using shm_open+mmap, and it generates an amount of cache memory in /proc/meminfo that corresponds exactly to the amount of shared memory (I load that data from a file but I am using posix_fadvise(fd,0,0,POSIX_FADV_DONTNEED) to ensure this file is not cached and I made sure that it is working as expected). As far as I know SHM memory was not tagged as cache memory with kernel 2.6.9.If it is the case it is really unfortunate since normally cache memory can be considered to be part of the "available" memory since it can be flushed promptly but this is clearly not the case with SHM memory... Is there an easy way to get the total amount of used SHM memory on a system?

View 4 Replies View Related

Fedora :: Where Are Stored PWs For Remote Desktop Viewer Stored?

Oct 20, 2010

I have machine that I used to VNC to on my network with Remote Desktop Viewer from my Fedora 12. When I first connected I checked the checkbox that I wanted to store the pw. Now the pw on the other machine has changed but Remote Desktop Viewer does not ask for a new password, it just gives me a black screen, like I am connected but I can't see anything. I'd like to know if anyone knows where this pw data is stored on the system so I can start fresh. I already tried uninstalling Remote Desktop Viewer and installing it again.

View 1 Replies View Related

Programming :: Where Are BASH Commands Stored

Feb 21, 2011

Where are the other BASH commands/exe stored? If the commands are part of the exe of BASH than ls would not be in a path, correct?

View 11 Replies View Related

Programming :: C Language Fuction Returns : Where And How Is The Fuctions Value Stored

May 23, 2010

I'm studying the C Language, None of the documents I'm reading covers returning values from a function. They state that the function sends the valve to the caller but that is the only info I have. Do I have to create a varible with the name of the function I called and is it stored there?

View 14 Replies View Related

Programming :: Where Printk Messages Stored When Call Insmod

Jul 8, 2011

where the printk messages are stored when we call a insmod? I'm using Slackware, and I think my distro can store these messages on others place.

View 3 Replies View Related

Programming :: Pass Variable In Mysql Qyery In C Programming?

Dec 4, 2010

i want to pass variable in mysql qyery in c programming

View 1 Replies View Related

OpenSUSE Install :: "write" Access For Data Stored In NTFS?

Jun 20, 2010

I have acces to NTFS partitions from OpenSuse 11.2, and read data, yet I cannot write changes of it. I tryed to change "rw" attributes using "sudo", and was not possible. Even the windows version I had is 7, the NTFS partition I want to access for writing, comes from a previous XP install. Is there a way to have "write" access for data stored in NTFS? I recall an install I had on a laptop with Windows XP and Ubuntu... and Ubuntu was able to write on NTFS; would it be possible in OpenSuse?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved