Quantcast

Maximum PC

It is currently Wed Apr 16, 2014 6:50 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Stupid problem
PostPosted: Tue Apr 20, 2010 5:42 pm 
Northwood
Northwood
User avatar

Joined: Sun Jul 15, 2007 6:37 pm
Posts: 2261
Location: No. 1 Thread Killer
This is a general/vague question that I'm sure someone's encountered here before, in C++ if not in similar vein.

I have a string that needs to be exposed and editable, it's a cstring (<typedef> const char* name, to be exact) I'm posting here because all of my attempts have failed, but here's the twist: it has to stay as said cstring.

Should I make a pointer to a &name?


Top
  Profile  
 
 Post subject: Re: Stupid problem
PostPosted: Mon Apr 26, 2010 10:35 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
Dwood15 wrote:
I have a string that needs to be exposed and editable, it's a cstring (<typedef> const char* name, to be exact).


Why do you need something that is a constant and editable? Can you not change the typedef because it is part of a shared object? Also, I don't have my Ansi-C manual handy but iirc a const pointer isn't the same thing as a normal constant. You need to check.

What do you mean by "exposed"?

BTW, creating a typedef called cstring is a bit dangerous. Most people consider a cstring to be a char[] in C. The point of using a typedef is to make the type definition more refined. For example, if I'm representing playing cards using an int value and a hand as an array of five ints, I would want to create Card and Hand typedefs. Creating a cstring typedef doesn't really do a whole lot especially when it isn't what most people consider to be a cstring.

Dwood15 wrote:
I'm posting here because all of my attempts have failed, but here's the twist: it has to stay as said cstring. Should I make a pointer to a &name?


Can you provide a snippet of the code? I'm having trouble imaging where things are going wrong. Is it when you call a function expecting a cstring? That doesn't seem likely. How about returning one? Why use one? etc.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group