C Question

2002-12-16 Thread David Eyler
Until just now I had thought that the two operations below were identical. A bug I just found in my code made me realize that they're not. Is there a C wiz out there that could explain the difference? Thanks so much. The Char*'s point into the dynamic heap, where they have been allocated with MemP

Basic "C" question

2001-09-30 Thread Todd Cary
var Dst: PChar; Src: PChar; begin StrCopy(Src, 'Demo string'); // So far so good // Now, how do I copy "string" to Dst? // I need a substring // This does not work: StrCopy(Dst, Src + 5); end; Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- For information on using the P

Basic "C" question

2002-04-01 Thread Edward P. Ross
Below is a sample of what I am trying to do. I have a database with the following datatype: Char Date[256]; In my function, I have: Char *encDate encDate = "34857384573498573498"; StrCopy(record.Date, encDate); error = AddToDateDatabase(&record); What I want to do is copy encDate into the reco

Re: C Question

2002-12-16 Thread Dave Lippincott
CTED]> Sent: Monday, December 16, 2002 4:40 PM Subject: C Question -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Re: C Question

2002-12-16 Thread Matthew Bevan
On December 16, 2002 02:03 pm, Dave Lippincott wrote: > #1 changes the address of fRecOne to point to the same memory location as > fRecPTwo No... By de-referencing the pointers, you make a shallow copy of the data. If it was written: frecPOne = fRecPTwo; You copy the pointers.

RE: C Question

2002-12-16 Thread Tony Goggin
> > Op #1: *fRecPOne = *fRecPTwo; > > Op #2: MemMove(fRecPOne, fRecPTwo, sizeof(FlightDB)); > Actually I would have expected these operations to be identical as well, except for overlapping memory areas (MemMove should handle it correctly; I would suspect that op#1's handling would be com

RE: C Question

2002-12-16 Thread Tony Goggin
> #1 changes the address of fRecOne to point to the same memory > location as > fRecPTwo ...but the pointers are being dereferenced, and thus shouldn't be modified - as long as the memory areas don't overlap, I would expect to see two different pointers pointing to the same data in both cases, no

Re: C Question

2002-12-16 Thread Mark Wilden
- Original Message - From: "David Eyler" <[EMAIL PROTECTED]> > Op #1: *fRecPOne = *fRecPTwo; > > Op #2: MemMove(fRecPOne, fRecPTwo, sizeof(FlightDB)); They should be the same, as others have noted, and the first is preferable (as less easy to screw up). The only thing I'd add is to say

Re: C Question

2002-12-16 Thread Chris Tutty
From: "Mark Wilden" <[EMAIL PROTECTED]> > Op #2: MemMove(fRecPOne, fRecPTwo, sizeof(FlightDB)); > > Op #3: MemMove(fRecPOne, fRecPTwo, sizeof *fRecPOne); > > is better than #2 since it doesn't hard-code the type in as many places. > True, but if you forget that critical * the code will compile

Re: C Question

2002-12-16 Thread Sean Charles
[..snip..] So near yet so far ;-) I can see *what* you wanted to do but as you admit, there is some confusion in your mind. Here's my two pence (euros?)... > Op #1: *fRecPOne = *fRecPTwo; From memory, what this will do is copy *one byte* from the memory at fRecPTwo into the memory starting at

Re: C Question

2002-12-16 Thread David Eyler
Thanks for all the help. It turns out that this point from Matthew, "By shallow I mean it copies the data exactly (it copies the pointers inside the structure, not the data the pointers point to.)" was my underlying problem, not the difference between the dereferencing copy operation and MemMove

Re: C Question

2002-12-16 Thread Mark Wilden
From: "Chris Tutty" <[EMAIL PROTECTED]> > From: "Mark Wilden" <[EMAIL PROTECTED]> > > Op #2: MemMove(fRecPOne, fRecPTwo, sizeof(FlightDB)); > > > > Op #3: MemMove(fRecPOne, fRecPTwo, sizeof *fRecPOne); > > > > is better than #2 since it doesn't hard-code the type in as many places. > > > True,

Re: C Question

2002-12-17 Thread Marco Pantaleoni
On Mon, Dec 16, 2002 at 05:48:23PM -0500, Tony Goggin wrote: > > > > > > Op #1: *fRecPOne = *fRecPTwo; > > > > Op #2: MemMove(fRecPOne, fRecPTwo, sizeof(FlightDB)); > > > > Actually I would have expected these operations to be identical as > well, except for overlapping memory areas (MemM

Re: C Question

2002-12-17 Thread Matt Graham
David Eyler wrote: Thanks for all the help. It turns out that this point from Matthew, "By shallow I mean it copies the data exactly (it copies the pointers inside the structure, not the data the pointers point to.)" was my underlying problem, not the difference between the dereferencing copy o

Re: C Question

2002-12-17 Thread Mike
It doesn't make sense to me that it would copy the data pointed to by pointers inside the structure. The SizeOf returns the size of the structure which doesn't take into consideration the size of the memory allocated to a pointer. In fact, there would be no way to know at compile time, how much d

Re: C Question

2002-12-18 Thread Marco Pantaleoni
On Tue, Dec 17, 2002 at 02:47:11PM -0500, Matt Graham wrote: > David Eyler wrote: > > Thanks for all the help. It turns out that this point from Matthew, > > > > "By shallow I mean it copies the data exactly (it copies the pointers > > inside the structure, not the data the pointers point to.)" >

POL/C++ question.

2003-06-02 Thread Nick
I need to add a single variable to a CTreeItem instance so I can access the variable when the event handler catches a user's leaf node selection. I've tried deriving CMyDefaultTreeItem from CDefaultTreeItem but the compiler complains with "cannot construct CMyDefaultTreeItem's base class POL::CDef

another C question

2000-09-23 Thread Grounderyoyo22
Most of you out there will think this is a dumb question, but it's confusing..If I have a variable of type char, and I want to set it with a variable and a string (i.e.-i want it to be equal to another char and append a string to it, like a variable number of days and the string " days"). I

Re: Basic "C" question

2001-09-30 Thread Joe Programmer
--- Todd Cary wrote: > var > Dst: PChar; > Src: PChar; > begin > StrCopy(Src, 'Demo string'); > // So far so good > // Now, how do I copy "string" to Dst? > // I need a substring > // This does not work: StrCopy(Dst, Src + 5); > end

Re: Basic "C" question

2001-09-30 Thread Bradly J. Barton
> --- Todd Cary wrote: > > var > > Dst: PChar; > > Src: PChar; > > begin > > StrCopy(Src, 'Demo string'); > > // So far so good > > // Now, how do I copy "string" to Dst? > > // I need a substring > > // This does not work: StrCopy(Dst, Src + 5); > > end; > > In C, you could do this:

Re: Basic "C" question

2001-09-30 Thread Douglas Olson - Pocket Technologies, Inc.
t; > Dst: PChar; > > Src: PChar; > > begin > > StrCopy(Src, 'Demo string'); > > // So far so good > > // Now, how do I copy "string" to Dst? > > // I need a substring > > // This does not work: StrCopy(Dst, Src + 5); > > e

Re: Basic "C" question

2001-09-30 Thread Todd Cary
Ans I would like to add that I have no experience with the Palm OS and as you can tell, my "C" experience is very rusty, yet I am amazed as to how quickly Pocket Studio has given me the tools to produce some difficult apps. Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- For informati

Re: Basic "C" question

2001-09-30 Thread Aaron Ardiri
On Sun, 30 Sep 2001, Todd Cary wrote: > var > Dst: PChar; > Src: PChar; > begin > StrCopy(Src, 'Demo string'); > // So far so good > // Now, how do I copy "string" to Dst? > // I need a substring > // This does not work: StrCopy(Dst, Src + 5); > end; kinda helps if you allocate th

Re: Basic "C" question

2001-09-30 Thread Aaron Ardiri
On Sun, 30 Sep 2001, Bradly J. Barton wrote: > > StrCopy(Src, "Demo string"); > > StrCopy(Dst, Src+5); > > Personally, I like to use: > > StrCopy(Dst, &Src[5]); > > But that's just a personal preference... nej :) pointers.. pointers... pointers :) one of the best things about C // az [E

Re: Basic "C" question

2001-10-01 Thread Todd Cary
Bradley - Many thanks! I forgot to use the "@str[2]" representation in Pascal (PocketStudio for the Palm). In my code, I have a field that contains a Time (e.g. 12:32) and I need to access the "12" and "32". It now worksagain thanks Todd -- Todd Cary Ariste Software [EMAIL PR

Re: Basic "C" question

2001-10-01 Thread Nullife
I think only 'D' will be copied to protected space. Single quotes, and all. -Nullife "Bradly J. Barton" <[EMAIL PROTECTED]> wrote in message news:63712@palm-dev-forum... > > > --- Todd Cary wrote: > > > var > > > Dst: PChar; > > > Src: PChar; > > > begin > > > StrCopy(Src, 'Demo string');

Re: Basic "C" question

2001-10-01 Thread Joe Programmer
--- Nullife <[EMAIL PROTECTED]> wrote: > I think only 'D' will be copied to protected space. > Single quotes, and all. No, he's using Pascal, which uses single quotes for strings. If he was using CodeWarrior C, 'Demo string' would be an illegal character constant. I don't know what gcc would t

Re: Basic "C" question

2001-10-02 Thread Douglas Olson - Pocket Technologies, Inc.
Todd, Here are two solutions for PocketStudio. One if you like VB and one if you like DELPHI -- Douglas Olson - President & Co-founder Pocket Technologies, Inc. - [EMAIL PROTECTED] - http://www.pocket-technologies.com Develop PalmOS applications with your Delphi skills Today! //***

Basic C/C++ Question

2001-12-07 Thread Johnathan Smith
I know this is not the right forum for a basic C/C++ question but I am writing and palm program that will have a list and I am going to make the lines in the list yellow/green/yellow and so on, But I dont know how to check to see if the row number is odd/even?? I have the row number can someone

RE: Basic "C" question

2002-04-01 Thread Peter Epstein
Actually, this is a PalmOS specific programming issue, if I understand your problem correctly. You want to copy a string into a database record. To write to a database record, you have to use specific APIs that check to make sure you don't write outside the record you're intending to modify. That

RE: Basic "C" question

2002-04-01 Thread Borislav Kolev
The I can only assume what you have left out of your example, but with these assumptions it is correct it should be typedef struct RecData { Char Date[256]; } RecData; void AddToDateDatabase(RecData* v); void foo() { RecData record; Char *encDate = "34857384573498573498"; StrCopy(record

Re: Basic "C" question

2002-04-01 Thread Ed
With the code below, I get the following error: "just read from memory location 0x003CD32, which is in the unused portion of the stack. The stack range is ... - ... and the stack pointer is ..." This does not happen everytime. Any ideas? Thanks, Ed. Borislav Kolev wrote: > The I can only

Re: Basic "C" question

2002-04-01 Thread Bradly J. Barton
I don't know if it will make a bit of difference, but when all else fails, start grasping at straws... I'd start by adding "const" to the char * declaration: const Char *encDate = "34857384573498573498"; Beyond that.. bobby's code below looks good to me, too. -- Bradly J. Barton - [EMAI

Re: Basic "C" question

2002-04-01 Thread John Leung
Try replace the following line Char *encDate = "34857384573498573498"; with Char encDate[] = "34857384573498573498"; Also, have you ever tried the following before? StrCopy(record.Date, "34857384573498573498"); On Mon, 01 Apr 2002 19:02:31 -0800, Ed <[EMAIL PROTECTED]> wrote: > >With the

Re: Basic "C" question

2002-04-02 Thread John Leung
Try replacing Char *encDate = "34857384573498573498"; with Char encDate[] = "34857384573498573498"; Also, have you try the following before? StrCopy(record.Date, "34857384573498573498"); On 1 Apr 2002 at 19:02, Ed wrote: > With the code below, I get the following error: > > "just read f

Re: Basic "C" question

2002-04-02 Thread Ed
This works StrCopy(record.Date, "34857384573498573498"); This fails = StrCopy(record.Date, encDate); It says that "Application just read from memory location X which is the unused portion of the stack. The stack is the area of RAM used to contain function parameters an

Re: Basic "C" question

2002-04-02 Thread Jake Donham
"Ed" == Ed <[EMAIL PROTECTED]> scribbles: Ed> This works StrCopy(record.Date, Ed> "34857384573498573498"); This fails = Ed> StrCopy(record.Date, encDate); It says that "Application just Ed> read from memory location X which is the unused portion of the

Re: Basic "C" question

2002-04-02 Thread Charu Venkatraman
t; Date: Tuesday, April 02, 2002 4:00 PM Subject: Re: Basic "C" question >This works StrCopy(record.Date, "34857384573498573498"); > >This fails = StrCopy(record.Date, encDate); >It says that "Application just read from memory loca

Re: Basic "C" question

2002-04-02 Thread John Leung
I can see why Char *encDate = "34857384573498573498"; might fail. Because you're assigning a pointer to some temp variable. It depends on when that temp variable decides to go out of scope, that pointer may no longer be valid. (Although I could be wrong. I'm not a C expert.) However, I'm

Re: Basic "C" question

2002-04-02 Thread Jake Donham
"Jake" == Jake Donham <[EMAIL PROTECTED]> asserts: Jake> What is the real declaration of Record? Sounds like you are Jake> writing off the end of the array, and hence the stack. Um, retract :). Jake -- For information on using the Palm Developer Forums, or to unsubscribe, please see

Re: Basic "C" question

2002-04-02 Thread Chris Tutty
From: "Ed" <[EMAIL PROTECTED]> > This works StrCopy(record.Date, "34857384573498573498"); > > This fails = StrCopy(record.Date, encDate); > It says that "Application just read from memory location X which is the unused portion of the stack. The stack is the area of RAM >

[OT] Re: C Question

2002-12-16 Thread Palm Developer
On Tue, 17 Dec 2002, Chris Tutty wrote: > > > True, but if you forget that critical * the code will compile > and run but not do what you want. I prefer the explicit > type because it's harder to screw up. Hmm, what would > be really cool is a pre-processor function to insert the > type of a v

RE: POL/C++ question.

2003-06-02 Thread Maks Pyatkovskiy
mData() functions. __ Best regards, Maks Pyatkovskiy > -Original Message- > From: [EMAIL PROTECTED] [mailto:bounce-palm-dev- > [EMAIL PROTECTED] On Behalf Of Nick > Sent: Monday, June 02, 2003 7:32 AM > To: Palm Developer Fo

Re: POL/C++ question.

2003-06-02 Thread Nick
ion. Use > CTreeItem::GetItemData(), CTreeItem::SetItemData() functions. > > __ > > Best regards, > Maks Pyatkovskiy > > > > -Original Message- > > From: [EMAIL PROTECTED] > [mailto:bounce-palm-dev- > > [EMAIL

an easy C question...

2000-12-11 Thread Eliah Ninyo
hello, i want to know how can i get the length of a string that is not initilize. for ex.: i have - char s[8]; this string length is 8. if i enter the string this: "home\0" , she will have only 5 cell full. and i can get this length by calling StrLen function. but i want to know the defeniti

an C++ question... plz?

2001-01-10 Thread Eliah NInyo
hello, i have the Oreilly book - "Palm Programming". at the end of the book it teaches how to deal with conduit and it show some code. for example at page 380 at the middle, there is a line that sat that: long CSalesConduitMonitor::ConstructRecord ( CBaseRecord*& pBase, CBaseTable& rtable, WOR

RE: another C question

2000-09-23 Thread P. Alan Johnson
: Saturday, September 23, 2000 7:18 PM > To: Palm Developer Forum > Subject: another C question > > > Most of you out there will think this is a dumb question, but it's > confusing..If I have a variable of type char, and I want to > set it with a > variable and a str

Re: another C question

2000-09-25 Thread Chris Tutty
<[EMAIL PROTECTED]> wrote > > Most of you out there will think this is a dumb question, but it's > confusing..If I have a variable of type char, and I want to set it with a > variable and a string (i.e.-i want it to be equal to another char and append > a string to it, like a variable number o

Basic C Question (pointer hell)

2006-11-08 Thread Greg
I have a MemPtr that is as a pointer to a custom structure (pdbLayout) PDBData = static_cast(MemPtrNew(size)); This is also the start of my data. I have a second pointer (Char* pOffset) that locates the end of the data. How can I find the size of the data? This is not the right way --- siz

RE: Basic C/C++ Question

2001-12-07 Thread Peter Epstein
% 2 == 0 I suggest you order a copy of this book and read it. I'm sure it's available from Amazon.com: C: A Reference Manual by Habison and Steele published by Prentice Hall ISBN 0-13-326224-3 It's an excellent reference for the C language. -- Peter Epstein --

Re: Basic C/C++ Question

2001-12-07 Thread Dave Lippincott
if(number%2) // odd else // even - Original Message - From: "Johnathan Smith" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> Sent: Friday, December 07, 2001 4:24 PM Subject: Basic C/C++ Question > I know this is not the right forum

RE: Basic C/C++ Question

2001-12-07 Thread Avilla, Dane
> I know this is not the right forum for a basic C/C++ > question but I am writing and palm program that will > have a list and I am going to make the lines in the > list yellow/green/yellow and so on, But I dont know > how to check to see if the row number is odd/even?? >

Re: Basic C/C++ Question

2001-12-07 Thread John Leung
UInt16 row=5; Boolean odd = ((row % 2) == 1); On 7 Dec 2001, at 13:24, Johnathan Smith wrote: > I know this is not the right forum for a basic C/C++ > question but I am writing and palm program that will > have a list and I am going to make the lines in the > list yellow/green/yell

RE: Basic C/C++ Question

2001-12-07 Thread Danny Epstein
Using % is the "right" answer, because it's self explanatory. You _could_ use & to mask out the least significant bit - that would be the geeky thing to do. Your compiler probably generates the same code in either case. -- For information on using the Palm Developer Forums, or to unsubscribe, pl

Re: [OT] Re: C Question

2002-12-16 Thread Alan Ingleby
(Adding wood to the impending fire...) When you want to get into that level of abstraction, you should be looking at C++, not C. Alan "Palm Developer" <[EMAIL PROTECTED]> wrote in message news:105449@palm-dev-forum... > > > > On Tue, 17 Dec 2002, Chris Tutty wrote: > > > > > > True, but if you fo

Re: [OT] Re: C Question

2002-12-17 Thread Matt Graham
Palm Developer wrote: On Tue, 17 Dec 2002, Chris Tutty wrote: #define MEMMOVE(d, s) MemMove(d, s, sizeof d) #define MEMMOVE(d,s) MemMove( &d, &s, sizeof(d) ) this needs the & doesn't it? -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com

Re: [OT] Re: C Question

2002-12-17 Thread Palm Developer
On Tue, 17 Dec 2002, Matt Graham wrote: > Palm Developer wrote: > > On Tue, 17 Dec 2002, Chris Tutty wrote: > > > > #define MEMMOVE(d, s) MemMove(d, s, sizeof d) > > #define MEMMOVE(d,s) MemMove( &d, &s, sizeof(d) ) > this needs the & doesn't it? > indeed it does! one more reason to avoid it ;)

Table drawing/C question/problem

2003-01-22 Thread Andy Black
Hi, In my program I have a table that I want to draw a note icon in a column if the record from my database has a note entry. However, every entry is drawing the note icon. From what I can tell my code should work. after I unpack the packedCE record into a ceRecord I have the following code:

Late night #define C question

2004-02-13 Thread David Webb
I know its something obvious but... I apologize for the C question on this forum, but why doesn't this work? #define MAX_DOWNLOAD_SIZE 46000 char msglabel[100]; StrPrintF(msglabel, "%u", MAX_DOWNLOAD_SIZE); The max value for a UInt16 is 65536. It works if I use "%lu&qu

Re: an easy C question...

2000-12-11 Thread Philip Sheard
> i want to know how can i get the length of a string that is not initilize. > for ex.: > > i have - > > char s[8]; > > this string length is 8. > > if i enter the string this: "home\0" , she will have only 5 cell full. and i > can get this length by calling StrLen function. > > but i want to know

RE: an easy C question...

2000-12-11 Thread Steve Austin
tells me its a pointer. Maybe I'm missing something here. Steve -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Philip Sheard Sent: Monday, December 11, 2000 4:12 AM To: Palm Developer Forum Subject: Re: an easy C question... > i want to know how

Re: an easy C question...

2000-12-11 Thread Dave Carrigan
"Steve Austin" <[EMAIL PROTECTED]> writes: > I guess I must be missing something. > > If you have: > > char s[8]; > > and you call: > > sizeof(s) shouldn't you get the size of a const char pointer on your system > (probably 4)? After all that's what s really is. No, that actually is not wha

Re: an easy C question...

2000-12-11 Thread krollin
oper Forum" <[EMAIL PROTECTED]> Sent by: "Philip Sheard" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> cc:(Keith Rollin/US/PALM) Subject: Re: an easy C question... > i want to know how can i get the length of a string t

Re: an easy C question...

2000-12-11 Thread Richard Burmeister
rom: "Dave Carrigan" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> Sent: Monday, December 11, 2000 1:43 PM Subject: Re: an easy C question... > "Steve Austin" <[EMAIL PROTECTED]> writes: > > > I guess I must be missing s

Re: an easy C question...

2000-12-11 Thread krollin
meister" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> cc:(Keith Rollin/US/PALM) Subject: Re: an easy C question... Dave, Your code example is not as useful in making your point as you might think. What your C compiler does on a

Re: an easy C question...

2000-12-11 Thread Dave Carrigan
"Richard Burmeister" <[EMAIL PROTECTED]> writes: > For example, using CodeWarrior and running on palmos35-dr4-en-color.rom, the > equivalent code gives different results. > > Char *p; > Char a[20]; > Char msg[50]; > > StrPrintF(msg, "sz(p) is %d; sz(*p) is %d; sz(a) is %d", sizeof(p), >

RE: an easy C question...

2000-12-11 Thread Steve Austin
Forum Subject: Re: an easy C question... "Steve Austin" <[EMAIL PROTECTED]> writes: > I guess I must be missing something. > > If you have: > > char s[8]; > > and you call: > > sizeof(s) shouldn't you get the size of a const char pointer on your syst

Re: an easy C question...

2000-12-11 Thread Jim Cooper
> char s[8]; is an array of 8 chars A char* is a pointer to a char, which might contain the address of s[0]. It is often important to remember that C doesn't actually have a string type like Pascal or BASIC etc does. You are essentially constructing one out of the low level pieces C provides (a

Re: an easy C question...

2000-12-11 Thread Richard Burmeister
m Developer Forum" <[EMAIL PROTECTED]> Sent: Monday, December 11, 2000 3:56 PM Subject: Re: an easy C question... > "Richard Burmeister" <[EMAIL PROTECTED]> writes: > > > For example, using CodeWarrior and running on palmos35-dr4-en-color.rom, the > > equi

Re: an C++ question... plz?

2001-01-10 Thread Dave Carrigan
"Eliah NInyo" <[EMAIL PROTECTED]> writes: > i know that "*" sign is to define a pointer and "&" sign if for address. > what what the combination mean??? Yes, * defines a pointer. The &, in a C++ function declaration, means pass by reference. So, func(int*&foo) { foo = new int; } means a f

Simple C question, pls help.

2001-02-02 Thread Oscar
Dear All, I have written the following code: void StringSearch( char* Input, char* A, char* B ) { A = strstr( Input, "<" ); B = strstr( Input, ">" ); } int main(int argc, char* argv[]) { char* CC = ""; char* AA = NULL; char* BB = NULL; StringSearch( CC, AA, BB ); return 0; } I ha

Re: Basic C Question (pointer hell)

2006-11-08 Thread Jeff Loucks
If you are asking a basic 'C' question, then the following will work just fine: unsigned long size; size = (unsigned long)((char *)pOffset - (char *)PDBData) + 1; Otherwise, you are asking a basic 'C++' question, so might I recommend the following: unsigned long size

re: Basic C Question (pointer hell)

2006-11-08 Thread James Lin
Greg wrote: > I have a MemPtr that is as a pointer to a custom structure > (pdbLayout) > > PDBData = static_cast(MemPtrNew(size)); > > This is also the start of my data. > > I have a second pointer (Char* pOffset) that locates the > end of the data. > > How can I find the size of the data? As

re: Basic C Question (pointer hell)

2006-11-09 Thread Greg
I am converting from C to C++ and I did not know about reinterpret_cast. Thank you Greg -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Re: Table drawing/C question/problem

2003-01-22 Thread DonelMac
Andy Black wrote: Hi, In my program I have a table that I want to draw a note icon in a column if the record from my database has a note entry. However, every entry is drawing the note icon. From what I can tell my code should work. after I unpack the packedCE record into a ceRecord I have th

Re: Table drawing/C question/problem

2003-01-23 Thread Sean Charles
if (ceRecord.note != NULL) { } When I drop into the debugger and look at what ceRecord.note is, it is "". Why is my if statement failing? Try taking the address of NULL, that should shake the grey cells a bit ;-) There is a world of difference between NULL and "", and indeed, in your case

Re: Table drawing/C question/problem

2003-01-23 Thread Andy Black
Thanks for the reply. I thought about for a while more last night and then it finally dawned on me. There are some things with C I still just don't get immediately. Andy On 1/23/03 4:23, in article 110224@palm-dev-forum, "Sean Charles" <[EMAIL PROTECTED]> wrote: > >> >> if (ceRecord.note != N

Re: Late night #define C question

2004-02-13 Thread Jan Slodicka
Hello, this will work: StrPrintF(msglabel, "%u", 46000U); or UInt16 x = 46000U ; StrPrintF(msglabel, "%u", x); Regards, Jan Slodicka - Original Message - From: "David Webb" <[EMAIL PROTECTED]> > I know its something obvious but... > >

Re: Late night #define C question

2004-02-13 Thread John Marshall
David Webb <[EMAIL PROTECTED]> wrote: > #define MAX_DOWNLOAD_SIZE 46000 [...] > StrPrintF(msglabel, "%u", MAX_DOWNLOAD_SIZE); When ints are 16 bits, the integer constant 46000 has type _long_ int, so amusingly enough is not what StrPrintF is expecting when you say "%u". Even more amusingly, 0xb3b

Re: Late night #define C question

2004-02-13 Thread David Webb
Thanks, Is there a good online reference for the C99 standard. -Dave "John Marshall" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > David Webb <[EMAIL PROTECTED]> wrote: > > #define MAX_DOWNLOAD_SIZE 46000 > [...] > > StrPrintF(msglabel, "%u", MAX_DOWNLOAD_SIZE); > > When ints are

Re: Late night #define C question

2004-02-13 Thread Ben Combee
At 06:00 PM 2/13/2004, you wrote: Thanks, Is there a good online reference for the C99 standard. You can buy a copy of the standard in PDF form from http://webstore.ansi.org/ansidocstore/product.asp?sku=ISO%2FIEC+9899%3A1999 for $33. http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html also h

Re: Simple C question, pls help.

2001-02-02 Thread Philip Sheard
> Dear All, > I have written the following code: > > void StringSearch( char* Input, char* A, char* B ) > { > A = strstr( Input, "<" ); > B = strstr( Input, ">" ); > } > > int main(int argc, char* argv[]) > { > char* CC = ""; > char* AA = NULL; > char* BB = NULL; > > StringSearch( CC,

SV: Simple C question, pls help.

2001-02-02 Thread Bulent Gecer
Shouldn't A = strstr( Input, "<" ); B = strstr( Input, ">" ); be A = StrStr( Input, "<" ); B = StrStr( Input, ">" ); ? /Bulent Gecer Oscar <[EMAIL PROTECTED]> skrev i diskussionsgruppsmeddelandet: [EMAIL PROTECTED] > > Dear All, > I have written the following code: > > void StringSearch( cha

SV: Simple C question, pls help.

2001-02-02 Thread Bulent Gecer
In PalmOS of course... sorry. Bulent Gecer <[EMAIL PROTECTED]> skrev i diskussionsgruppsmeddelandet:[EMAIL PROTECTED] > > Shouldn't > > A = strstr( Input, "<" ); > B = strstr( Input, ">" ); > > be > > A = StrStr( Input, "<" ); > B = StrStr( Input, ">" ); > ? > > /Bulent Gecer > > Oscar <[EMAIL P

very basic palm-C question: why using static functions?

2004-12-19 Thread Sony Santos
Hello, The PODS 1.0 sample "Hello World" uses static functions instead of normal functions. Why? Doing that makes process to run faster? Does it save memory? Should I use static functions on my palm projects too? I'm sorry for the so very basic C question, but I think the

Re: very basic palm-C question: why using static functions?

2004-12-19 Thread Ben Combee
At 09:13 AM 12/19/2004, Sony Santos wrote: Hello, The PODS 1.0 sample "Hello World" uses static functions instead of normal functions. Why? Doing that makes process to run faster? Does it save memory? Should I use static functions on my palm projects too? I'm sorry for the

Re: very basic palm-C question: why using static functions?

2004-12-20 Thread Sony Santos
Great! Thank you very much - that is just I want know! Sony -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/