Steve
The if(_item[0] == 'T') works great
Now I have to go learn c
Thanks To all Jerry

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Steve Ellenoff
Sent: Wednesday, July 29, 2009 10:30 AM
To: [email protected]
Subject: Re: C functions

At 11:07 AM 07/29/2009, you wrote:
>On Wed, Jul 29, 2009 at 10:53, Jerry Foote<[email protected]> wrote:
> > Does anyone know of a table that lists C functions with similar 
> functions to
> > VFP? Or maybe basic
> >
> > Right now I'm struggling with this code
> >
> > if ( strcmp( _item,"T123" ) != 0)
> >
> > I want to be able to write the expression to test if first letter in
_item
> > is "T"
> >
> > In vfp I could write if substr(_item,1,1)="T"
>
>If I remember my C correctly, that's:
>
>if (*_item = 'T')
>
>But it's been a while. :-)


The above code has the infamous C = bug. You need to use == instead, 
as follows:

if(*_item == 'T')

Also, you could use the following code which I tend to prefer:

if(_item[0] == 'T')

since a string is an array of characters in C, and if you're not used 
to pointer notation as shown by Garrett, this is a bit easier to 
follow. Realize that all arrays start with 0 in C, not 1 like in Fox.

HTH-
-Steve



[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/3d87bdb2dacd40e9aaf8599978bce...@laptop
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to