Sponsored Content
Top Forums Programming Storing C++-struct in file - problem when adding new item in struct Post 302569725 by Corona688 on Tuesday 1st of November 2011 11:08:54 AM
Old 11-01-2011
You are mistaken. You cannot store "char *" in a file this way. You are storing pointers which, when you get them back, happen to point to some valid location in memory, but no mystical translation is happening -- a pointer is stored as 4 or 8 bytes, the data you wanted to store was never stored.

You must use fixed-size arrays like everything else.
 

10 More Discussions You Might Find Interesting

1. Programming

struct tm problem

I receive an integer as argument for a function. within function definition i want it to be of type struct tm. eg.. main() { int a; ...... } function(...,..,a,..) int a; { struct tm tm; if(!a) ^ time(&a); ^ ... (4 Replies)
Discussion started by: bankpro
4 Replies

2. Programming

Problem accessing struct member

I have a struct as follows... struct A { int a; ucontext_t X; //ucontext_t is another structure } How do I define a pointer to the above structure variable X of the type ucontext_t from within another function? eg. void foo() { struct A a; /////WHAT COMES IN... (1 Reply)
Discussion started by: jacques83
1 Replies

3. Programming

writing binary/struct data to file

I am trying to write binary data to a file. My program below: #include <stdlib.h> #include <stdio.h> struct tinner { int j; int k; }; struct touter { int i; struct tinner *inner; }; int main() { struct touter data; data.i = 10; struct tinner... (4 Replies)
Discussion started by: radiatejava
4 Replies

4. UNIX for Advanced & Expert Users

problem with netfilter hook function struct skbuff *sock is null..

iam trying to built a firewall.so i have used netfilter for it. in function main_hook sock_buff is returning null and in my log file continuously "sock buff null" is printed plse help to solve this problem.. (using print_string iam printing strings on current terminal (terminal we ping)) ... (1 Reply)
Discussion started by: pavan6754
1 Replies

5. UNIX for Dummies Questions & Answers

How to access a struct within a struct?

Can someone tell me how to do this? Just a thought that entered my mind when learning about structs. First thought was: struct one { struct two; } struct two { three; } one->two->three would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies

6. Programming

Compiling virtual network adapter driver problem (net_device struct)

Hi, I found on linuxgazette.net/93/bhaskaran.html page very useful sample of virtual driver (not connected to real hardware). I try to compile it with no effect. So: I got fresh Ubuntu 9.10 (kernel 2.6.31-14) My source is saved in networkAdapter.c file in /usr/src/myModules directory. I... (21 Replies)
Discussion started by: Chrisdot
21 Replies

7. Programming

Can't assign struct variable in header file

Hi guys. I have a header file including a structure like this: typedef struct { int index = -1; stack_node *head; } stack; But when compiling with cc it shows error at the assignment line (int index = -1): error: expected ‘:', ‘,', ‘;', ‘}' or ‘__attribute__' before ‘=' token... (1 Reply)
Discussion started by: majid.merkava
1 Replies

8. Programming

Problem defining a struct

I have the following code and getting the compilation errors baseLib/DynBaseObj.h:80: error: expected constructor, destructor, or type conversion before ‘(' token baseLib/DynBaseObj.h:89: error: expected constructor, destructor, or type conversion before ‘(' token baseLib/DynBaseObj.h:101:... (0 Replies)
Discussion started by: kristinu
0 Replies

9. Programming

search file and put into struct

hi everybody, I need some help with some programming. I need to write a file that can search in a text file and read the whole line into a struct. the struct = struct Transistor { char chType; char chFabrikant; float fPrijs; enum Transistor_Behuizing { empty,TO18, TO39,... (8 Replies)
Discussion started by: metal005
8 Replies

10. Programming

Python Results Converted To C Struct Header File

I created python code that produce output in the form of: moses-red-sea=1.00.03 genesis-snake=2.03 deliverance=5.0.010 I need to take this output and create a "C" header file and have it look like this: struct { char *name; char *fixed_version; } filename_versions... (7 Replies)
Discussion started by: metallica1973
7 Replies
GLCLEARBUFFERSUBDATA(3G)					   OpenGL Manual					  GLCLEARBUFFERSUBDATA(3G)

NAME
glClearBufferSubData - fill all or part of buffer object's data store with a fixed value C SPECIFICATION
void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void * data); PARAMETERS
target Specify the target of the operation. target must be one of the global buffer binding targets. internalformat The internal format with which the data will be stored in the buffer object. offset The offset, in basic machine units into the buffer object's data store at which to start filling. size The size, in basic machine units of the range of the data store to fill. format The format of the data in memory addressed by data. type The type of the data in memory addressed by data. data The address of a memory location storing the data to be replicated into the buffer's data store. DESCRIPTION
glClearBufferSubData fills a specified region of a buffer object's data store with data from client memory. offset and size demark the extent of the region within the data store of the buffer object bound to target to fill with data. Data, initially supplied in a format specified by format in data type type is read from the memory address given by data and converted into the internal representation given by internalforamt. This converted data is then replicated throughout the specified region of the buffer object's data store. If data is NULL, then the subrange of the buffer's data store is filled with zeros. ERRORS
GL_INVALID_ENUM is generated if target not one of the generic buffer binding targets. GL_INVALID_VALUE is generated if no buffer is bound to target. GL_INVALID_ENUM is generated if internalformat is not a sized internal format. GL_INVALID_VALUE is generated if offset or range are not multiples of the number of basic machine units per-element for the internal format specified by internalformat. GL_INVALID_VALUE is generated if offset or size is less than zero, or if offset + size is greater than the value of GL_BUFFER_SIZE for the buffer bound to target. GL_INVALID_OPERATION is generated if any part of the specified buffer range is mapped with glMapBufferRange() or glMapBuffer(). SEE ALSO
glClearBufferData(). COPYRIGHT
Copyright (C) 2012 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. AUTHORS
opengl.org opengl.org 06/10/2014 GLCLEARBUFFERSUBDATA(3G)
All times are GMT -4. The time now is 02:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy