LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-09-2005, 10:09 AM   #1
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Rep: Reputation: 16
a simple pointer problem


struct fileMetaData /* contains the metadata about the file */
{
char * positionptr; /* where next char is written or read */
char * fileptr; /* where in memory the file is placed */
const char * file_name; /* the name of the file */
const char * file_mode; /* in which mode its created: "r", "w", "a" */
char * lastaddress; /* the last byte from the fileptr address */
};

struct fileTable /* provides a backbone: holds each file entry */
{
struct fileTable *next; /* next file entry */
struct fileMetaData fileno; /* pointer to fileMetaData str.*/
};


and i define :

struct fileTable *nextfile;

Now, executing the statement:

*(nextfile->fileno.positionptr++);
should give me the char pointed to by 'positionptr' + the positionptr should move one byte.BUt actually its not happening,

what is the correct statement of doing this?
 
Old 03-09-2005, 11:11 AM   #2
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Rep: Reputation: 15
Are you sure you have initialized the "struct fileTable *nextfile" pointer?? Is it pointing to something ??
 
Old 03-09-2005, 11:05 PM   #3
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Original Poster
Rep: Reputation: 16
ya, actually i m getting the nextfile as a formal argument in the function :

int fileread(char *bufferarray, int size, int count, struct fileTable *nextfile)

{
.....
....
}

and the calling function is verified to have passed a legal address in nextfile.

any suggestions would be highly appriciated

Last edited by kapsikum; 03-10-2005 at 01:07 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pass pointer,, return pointer??? blizunt7 Programming 3 07-23-2005 01:36 PM
returning data to main() via a pointer to a pointer. slzckboy Programming 3 05-30-2005 01:20 PM
pointer dereference problem cranium2004 Programming 4 05-03-2005 09:34 AM
hot to set value of pointer to pointer to a structure in C alix123 Programming 2 11-17-2004 06:40 AM
Problem about pointer in C akin81 Programming 5 04-03-2004 06:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration