Programming :: STL Container Into A C Struct

May 23, 2011

I have an old C application in which i am trying to include some STL cointainers. When i use the STL container alone it works fine, but when i include it into a C struct i have segmentation faults errors. I know that it is not a good idea to mix C and C++. Considering this code:

Code:

typedef struct{
int shmid;
...
APPLSPACETYPE applSpace;

[code]...

and how to make a malloc for this issue; something like :

Code:

mem->applSpace.rData.completeGroups2zeroGroup=(map_completeGroups2zeroGroup_type *)malloc((sizeof(map_completeGroups2zeroGroup_type)+1)* sizeof(char ));

View 11 Replies


ADVERTISEMENT

Programming :: Use A Class Inside A Struct?

Apr 8, 2011

Is is possible to use a class inside a struct? I keep getting segmentation fault with this code:

Code:

struct my_struct {
unsigned count;
std::string msg;

[code]....

View 3 Replies View Related

Programming :: Difference Between Struct And Union?

Nov 6, 2010

I have been spending time (starting yesterday) reverse-engineering GTK+ to get my programming skills up. I came across a struct in the headers (_GtkArg, which was then typedeffed into GtkArg) that includes a union in it that has pretty much the same properties as a struct. Then, there was a struct inside the union.

I'm confused. Just what is the difference between a union and a struct?

P.S. I am using GTK's native C programming language.

View 8 Replies View Related

Programming :: Memory Allocation For Struct In C++?

Mar 30, 2010

How do we allocate memory of struct? what i did was

Code:

int main()
struct amp
{

[code].....

cout <<"The size of 'struct' is"<< sizeof(struct amp)<<"and it is located at"<<struct amp*s = malloc(sizeof(struct amp))<<endl;
it gives me an error---
In funtion 'int main()':
error: expected primary-expression before 'struct'
error: expected ';' before 'struct'

View 9 Replies View Related

Programming :: Python Serial And Struct On 64 Bit?

May 14, 2010

For a work project, I've got a bunch of python code from about a year ago that controls the movement of our EVI-D30 camera over a ttyUSB connection. It used to work fine on a 32-bit Fedora box, but recently we moved our whole project over to a 64-bit Gentoo server, and the same code seems to be worthless on the new platform. I didn't write the code, so I'm have trouble figuring out how to fix it. Error messages usually look like this:

Code:

File "./CameraController.py", line 172, in pan
turn_callback(cmdStruct[0], cmdStruct[1])
File "./CameraController.py", line 147, in turn_callback
cameras[camera].TiltUp()

[code]....

View 13 Replies View Related

Programming :: Stl Vector As A Member Of A Struct?

Jan 17, 2011

is there any problem that might rise by by having a vector as a member of struct in c++ as follows.ex.

struct A
{
int a;

[code]...

View 2 Replies View Related

Programming :: Store H.264 File On Avi Container?

Mar 4, 2010

i m trying to store h.264 in avi container using ffmpeg....is it possible using ffmpeg.i m using v4l to capture a image and compressed in to h.264, how i can store it in avi container,any programming example,header format for avi container,and what other information required to store in a container.

View 14 Replies View Related

Programming :: Access Value From Nested Struct <c Language>?

Mar 11, 2010

I having a nested structures which are referenced with pointer variables :

example :
typedef struct {
int a ;
char *b ;
int *c ;
}EXP2 ;

[Code]...

While trying to access the value of sv.exp2->a it throws segmentation fault error.How to acess this variable ??

View 3 Replies View Related

Programming :: Sizeof Struct With Function Pointers As A Member?

Jul 2, 2010

I following structure
typedef struct
{

[code]...

View 5 Replies View Related

Programming :: Dereferencing Pointer To A Shared Memory Struct?

Feb 5, 2011

I have what should be a relatively simple program (fadec.c) that maps a struct from an included header file (fadec.h) to a shared memory region, but Im struggling accessing members in the struct from the pointer returned by shmat. Ultimately, I want to access members in the shared memory structure with a globally declared version of the struct, shm__. Not only do I not know how to accomplish that, but I cant even seem to access members of the shared struct directly from the pointer itself (compiler complains about dereferencing pointer to incomplete type). Im at a loss and could use another set of eyes if you guys dont mind taking a gander:

Compile Errors:
tony-pc:/cygdrive/p/test> cc -o fadec fadec.c
fadec.c: In function 'main':
fadec.c:30: error: dereferencing pointer to incomplete type
fadec.c:31: error: dereferencing pointer to incomplete type

[Code]...

View 1 Replies View Related

Programming :: Struct Timeval Doesn't Keep After Function Returns

Jun 2, 2010

int GetTime(struct timeval tv)
{
gettimeofday(&tv, NULL)
printf("%d
", tv.tv_sec); /* here is the right value */
return 0;
}

[Code]....

What happend? struct timeval has a self timer?

View 3 Replies View Related

Programming :: Create A Global Struct Variable With Predefined Member Values?

May 26, 2010

Is it possible to create a global struct variable with predefined member values?Only one instance of that struct is ever needed.

View 1 Replies View Related

Programming :: Differences Between Ncurses Library And Termios Struct W.r.t Keyboard Reading

May 3, 2010

I want to read a pressed key or a combination of pressed keys from the keyboard and perform some action afterwords.

e.g.

Ctrl-Alt-F1

Out of ncurses lib. and the termios struct which can be used best for the above purpose and why ?I tried to search on Google, the differences between these two but couldn't get much !

View 6 Replies View Related

Programming :: Kernel API *get_super (struct Block_device *bdev) Producing Error With Fedora Core 5

Feb 2, 2011

I understand that block_device pointer *bd sholuld get initialized. Program should produce initialization error for *bd. Compiler is producing '->'. I am not understanding why?

[code]...

View 1 Replies View Related

Programming :: Kernel Module - Task_struct / Files Struct, Open_fds, And The Open File Descriptors In Task?

May 1, 2010

This for Kernel 2.6.29.6. I'm trying to code a kernel module that displays process information.

how to count opened file descriptors per task. I have been able to write a module that lists all the current process names along with their pid number in /var/log/messages. Basically, I cycle through the ring of processes using the macro for_each_process(task) and printk the comm and pid of each task. I'm trying to see how many file descriptors each task has open. I've been reading up in books and all over the internet. At first I thought I needed to access max_fds under files_struct, but that just lists the maximum number of file descriptors that can be opened per task, which by default is set at 256. I then thought about counting the elements in the fd_array. But then I learned that every task's fd_array is initially set at 32. Now I know that I need to access open_fds of type fd_set * in files_struct. open_fds is a pointer to all the open file descriptors. The problem is that I don't know how to access a pointer of type fd_set.

Is there a good guide or book that really focuses on type fd_set and open_fds? Every book and resource I've read never really go into depth on this. relationship between files struct, open_fds, and the open file descriptors in task?

View 4 Replies View Related

Ubuntu :: How Much CPU Should FF Plugin Container Use

Aug 28, 2010

How much of CPU should Firefox plugin continer be using? and what about Firefox bin? What are reasonable figures?

I've been monitoring them and seems to me at times they are running high, 40,50% even higher at times though then it drops back.

View 5 Replies View Related

Ubuntu :: Why Does Plugin-container Use So Much RAM?

Jul 1, 2011

When I use firefox, I accumulate multiple plugin-container processes, typically one of them sits around hanging onto well over 200 MB of RAM. I think this happens when I watch flash videos. Does simply having a flash app on a web page cause a plugin-container process to be created? Will they ever go away without my explicitly killing them or closing firefox? If they stay around, do they ever free any RAM?

View 1 Replies View Related

Ubuntu :: Field 'struct' Has Incomplete Type

May 13, 2011

I'm building a symbol table and syntax tree using lex and yacc for a compiler.

I am stuck with an error for too long. I have defined two structures (one for Symbol Table and another for Syntax Tree).

Code:
typedef struct symbolTable{
char name[30];
.....
struct symbolTable *next;

[Code]......

here's the error:

bottomup.y:76: error: field 'info' has incomplete type.

I tried to define the structure definitions in a separate header file and included in .y file but it didn't work out.

I'm trying to get this done ASAP.

View 1 Replies View Related

Ubuntu Multimedia :: Best Codec And Container?

Jun 1, 2010

So I know that Mac OSX post-production and Linux post-production are very different things. I'm hoping to give editing on Linux with Cinelerra a try and I'm wondering, what in FFMpeg's array of codec and container support is widely understood to be the best combination for editing video. I'm looking for the most lossless option so H.264 won't do. Is there a good Apple Intermediate Codec or Apple Pro Res equivalent? Is AVCHD the answer?

View 2 Replies View Related

General :: LVM Groups And Partitioning Container

May 16, 2010

I am trying to install my debian again. In this time I want to encrypt it using LVM and later LUks. How I do that? I am in installation process. And I want to create a Group LVM and later partition the container.

View 12 Replies View Related

General :: Find Words 'struct' And 'messages_sdd_t' In Many Files

Apr 23, 2010

I am looking for this struct messages_sdd_t and I need to search through a lot of *.c files to find it. However, I can't seen to find a match as I want to exclude all the words 'struct' and 'messages_sdd_t'. As I want to search on this only 'struct messages_sdd_t' The reason for this is, as struct is used many times and I keep getting pages or search results. I have been doing this without success:

find . -type f -name '*.c' | xargs grep 'struct messages_sdd_t'

and this

find . -type f -name '*.c' | xargs egrep -w 'struct|messages_sdd_t'

View 2 Replies View Related

Ubuntu :: Cryptsetup Container Ain't Mountable Anymore?

Jan 22, 2011

i have a cryptsetup container, which after freshly setting up the computer isn't mountable anymore. Google didnt help me much soSince i use a keyfile, it cant be the passphrase.This is what i do:Quote:

losetup /dev/loop0 /home/data.img
cryptsetup -d super-secret-key.file data /dev/loop0
mount /dev/mapper/data /data

[code]....

View 4 Replies View Related

General :: Print List Of All Users In The Container

Apr 7, 2011

We are using OES 10.00 and would like ot print list of all users in the container.

View 3 Replies View Related

Ubuntu Servers :: 10.04 - Correct Procedure To Move LXC Container

May 6, 2010

I have a Ubuntu 10.04 server configured with an lxc container also running 10.04. I wonder if somebody knows the correct procedure to move such a container to another server? I tried a straight rsync both with the source up and down but mysql won't start on boot after move and if I manually start it none of the websites within the container are able to connect to mysql. I can connect to mysql using telnet of the command line client.

View 1 Replies View Related

Ubuntu Security :: Truecrypt Container And Clearing Swap?

Sep 27, 2010

my current plan is to create a truecrypt container with the whirlpool hash. This container will be located on a hdd that is not where my OS will be located (so a separate physical sata drive).My concern is when this container is accessed, that some of the password information could be stored in my swap partition (which is on the main drive where the OS "/" is located)

I would like to have a script or command I could run that after I unmount those drives (or just halt the system) that my swap (and ram too if possible) could be wiped (or like overwritten with the shred command). Also, am I going about this the right way, or should I just use truecrypts FDE on the entire drive? In addition, when Ubuntu does it's default install, does it create a swap file in addition to a swap partition? If it does, would that be another vulnerability? If it is, how do I prevent this from happening?

I welcome any input you have on this. I am aware that once the drive is mounted, it is vulnerable, but I want the data to be secure as possible once my computer is turned off. Also, I have read that there are ram exploits where it holds your passwords for up to a few minutes after you turn the machine off, does anyone know how long that it and is there a way to clear it, or will only time let it fade?

View 1 Replies View Related

Ubuntu Multimedia :: Multiple Dvd Titles In Single Container?

Aug 24, 2011

I am using DVD::rip to convert some instructional DVD's to .avi (xvid + mp3). I have never used this app before but its seems fairly straight forward and easy to use. I am able to convert 1 title from the DVD to 1 avi file. One DVD however has 19 titles which vary from 3-5 minutes in length. My question is, can I convert all or at least some titles to a single .avi file and if so how?

View 1 Replies View Related

General :: Convert A Video File To Mxf Mxf Container Format?

May 31, 2010

I am trying to convert a mpg video file to mxf container format using ffmpeg by follwing command. ffmpeg -y -i INPUT.mpg -s 640x480 -vcodec mjpeg -b 5Mb -minrate 4Mb -maxrate 6Mb -bufsize 3Mb -an -f mxf OUTPUT.mxf

I get this error::

FFmpeg version 0.5.2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-shared --enable-libmp3lame
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1

[Code]....

View 2 Replies View Related

Server :: Directory Max Size For Virtual User Under Container?

May 19, 2011

I am running Debian under virtual container. I need to set max size of directory for each of vsftpd virtual users - because they are virtual, I cannot use user quotas. I was wondering, if I could create images with filesystem and mount them, but I cannot access /dev/loop device from container. Is there any other way, how to set max directory size in virtual container

View 2 Replies View Related

Software :: Convert A Video File To Mxf Container Format?

Jun 1, 2010

I am trying to convert a video file to mxf container format using ffmpeg.But not able to achieve the goal.This the command which i used.ffmpeg -i smirnoff_edlp2ok4.mpg -vcodec mpeg2video -b 450k -acodec libmp3lame -ab 64k -ar 48000 -y op.mxf

View 1 Replies View Related

Applications :: Mount Or Make An Encrypted Container A Message Pops Up?

Jan 7, 2010

I am running Pclinuxos with KDE 4.3.4. I have installed Truecrypt but am having problems using this program when the user is not root. If I try to mount or make an encrypted container a message pops up saying: Administrator privileges required: enter user password or administrator password

When I enter the root password a box then says: Failed to obtain administrator privileges: username is not in the sudoers file. This incident will be reported

I can't understand why this has happened as I gave the root password. Once I provide the root password, surely I become all powerful and the system should let me do anything? Also to mount a encrypted file in Truecrypt I have to assign full write permissions for users to the /media directory. Is this safe to do?

The only way I have found to use Truecrypt with a non root user account is to go to super user mode terminal, sign in with root password, CD to the truecrypt directory and launch Truecrypt from the terminal. I find this very laborious to do every time.

View 2 Replies View Related







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