Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

POD development

8 posts in General Discussion Last posting was on 2005-07-13 14:44:41.0Z
Robert Posted on 2005-07-06 11:58:11.0Z
Reply-To: "Robert" <robert@cyberprop.com>
From: "Robert" <robert@cyberprop.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
Subject: POD development
Lines: 10
Organization: USP Designs
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-Original-NNTP-Posting-Host: rrba-146-126-231.telkomadsl.co.za
Message-ID: <42cbc74f@forums-2-dub>
X-Original-Trace: 6 Jul 2005 04:58:07 -0700, rrba-146-126-231.telkomadsl.co.za
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 6 Jul 2005 04:58:08 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 6 Jul 2005 04:58:11 -0700
X-Trace: forums-1-dub 1120651091 10.22.108.75 (6 Jul 2005 04:58:11 -0700)
X-Original-Trace: 6 Jul 2005 04:58:11 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:447
Article PK: 8879

Writting a pod to return list of images in a directory.
I cannot see why only the first letter of the string "wrote" is returned.
If there are no files "No_files_found" is returned correctly but if images
exist only the first letter is returned

I think it has to do with the casting of wrote into the PODSString ret.
Any help appreciated
Thanks


Robert Posted on 2005-07-13 10:53:33.0Z
Reply-To: "Robert" <robert@cyberprop.com>
From: "Robert" <robert@cyberprop.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <42cbc74f@forums-2-dub>
Subject: Re: POD development
Lines: 47
Organization: USP Designs
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: rrba-146-84-196.telkomadsl.co.za
X-Original-NNTP-Posting-Host: rrba-146-84-196.telkomadsl.co.za
Message-ID: <42d4f2ad@forums-1-dub>
Date: 13 Jul 2005 03:53:33 -0700
X-Trace: forums-1-dub 1121252013 165.146.84.196 (13 Jul 2005 03:53:33 -0700)
X-Original-Trace: 13 Jul 2005 03:53:33 -0700, rrba-146-84-196.telkomadsl.co.za
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:462
Article PK: 8890

Got it to work.
Here is working code for any that might need it.

static PODSString SendFileObjectGetimagelist(PODSObject *podsObj, PODSString
filedir)
{
SendFileObject *self = (SendFileObject *)podsObj;
HANDLE fileHandle;
TCHAR wrote[400];
TCHAR wrotein[400];
//char *ret;
char ret[400];
char retCat[400];
ULValue val;
PODSString retval;
WIN32_FIND_DATA FindFileData;
if (0 == strcmp(filedir, "Avantgo"))
{
CreateDirectory(L"program files\\avantgo\\images", NULL);
fileHandle = FindFirstFile(TEXT ("\\Program
files\\AvantGo\\images\\*.jpg"),&FindFileData);
}else{
fileHandle = FindFirstFile(TEXT ("\\My Documents\\My
Pictures\\*.jpg"),&FindFileData);
}
if (fileHandle == INVALID_HANDLE_VALUE)
{
wsprintf(wrote, L"%s","No_Files_Found");
retval = (const char *) wrote;
}else{
sprintf(ret, "%S", (WCHAR *)FindFileData.cFileName );
strcpy(retCat, (const char*)ret);
retval = (const char *) retCat;
while (FindNextFile( fileHandle,&FindFileData ) != 0)
{
sprintf(ret, "%S%S", " ", (WCHAR *)FindFileData.cFileName );
retval = strcat((char*)retval, (char*)ret);

}
retval = (const char *) retval;
}

FindClose(fileHandle);
return retval;
}


Enrico Pallazzo Posted on 2005-07-13 14:36:35.0Z
From: "Enrico Pallazzo" <enricopallazzo@myway.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <42cbc74f@forums-2-dub> <42d4f2ad@forums-1-dub>
Subject: Re: POD development
Lines: 56
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Original-NNTP-Posting-Host: hanger18.sybase.com
Message-ID: <42d526ef$1@forums-2-dub>
X-Original-Trace: 13 Jul 2005 07:36:31 -0700, hanger18.sybase.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 13 Jul 2005 07:36:32 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 13 Jul 2005 07:36:35 -0700
X-Trace: forums-1-dub 1121265395 10.22.108.75 (13 Jul 2005 07:36:35 -0700)
X-Original-Trace: 13 Jul 2005 07:36:35 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:463
Article PK: 8889

You are still returning a stack variable from a function. You must use
malloc and free for anything returned from a pod. You program may work in
your debug setup but you will have problems when you deploy to a lot of
users.

"Robert" <robert@cyberprop.com> wrote in message
news:42d4f2ad@forums-1-dub...
> Got it to work.
> Here is working code for any that might need it.
>
> static PODSString SendFileObjectGetimagelist(PODSObject *podsObj,
> PODSString filedir)
> {
> SendFileObject *self = (SendFileObject *)podsObj;
> HANDLE fileHandle;
> TCHAR wrote[400];
> TCHAR wrotein[400];
> //char *ret;
> char ret[400];
> char retCat[400];
> ULValue val;
> PODSString retval;
> WIN32_FIND_DATA FindFileData;
> if (0 == strcmp(filedir, "Avantgo"))
> {
> CreateDirectory(L"program files\\avantgo\\images", NULL);
> fileHandle = FindFirstFile(TEXT ("\\Program
> files\\AvantGo\\images\\*.jpg"),&FindFileData);
> }else{
> fileHandle = FindFirstFile(TEXT ("\\My Documents\\My
> Pictures\\*.jpg"),&FindFileData);
> }
> if (fileHandle == INVALID_HANDLE_VALUE)
> {
> wsprintf(wrote, L"%s","No_Files_Found");
> retval = (const char *) wrote;
> }else{
> sprintf(ret, "%S", (WCHAR *)FindFileData.cFileName );
> strcpy(retCat, (const char*)ret);
> retval = (const char *) retCat;
> while (FindNextFile( fileHandle,&FindFileData ) != 0)
> {
> sprintf(ret, "%S%S", " ", (WCHAR *)FindFileData.cFileName );
> retval = strcat((char*)retval, (char*)ret);
>
> }
> retval = (const char *) retval;
> }
>
> FindClose(fileHandle);
> return retval;
> }
>


Greg Fenton Posted on 2005-07-13 14:44:41.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla Thunderbird 1.6.3.2f (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.mbusinessanywhere.general
Subject: Re: POD development
References: <42cbc74f@forums-2-dub> <42d4f2ad@forums-1-dub>
In-Reply-To: <42d4f2ad@forums-1-dub>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: gfenton-t30.sybase.com
Message-ID: <42d528d5$1@forums-2-dub>
X-Original-Trace: 13 Jul 2005 07:44:37 -0700, gfenton-t30.sybase.com
Lines: 30
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 13 Jul 2005 07:44:38 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 13 Jul 2005 07:44:41 -0700
X-Trace: forums-1-dub 1121265881 10.22.108.75 (13 Jul 2005 07:44:41 -0700)
X-Original-Trace: 13 Jul 2005 07:44:41 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:464
Article PK: 8891


Robert wrote:
> TCHAR wrote[400];
> [...]
> wsprintf(wrote, L"%s","No_Files_Found");
> retval = (const char *) wrote;

Instead of declaring the memory for the "wrote" variable on the stack
(as above), I strongly suggest that you dynamically allocate the memory
(as Enrico suggested):

TCHAR *wrote;
[...]

wrote = (TCHAR *)malloc(sizeof(TCHAR) * 400);
if ( NULL == wrote ) {
// could not allocate memory....bail out!
return NULL;
}
[...]


Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/


Robert Posted on 2005-07-06 12:01:09.0Z
Reply-To: "Robert" <robert@cyberprop.com>
From: "Robert" <robert@cyberprop.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <42cbc74f@forums-2-dub>
Subject: Re: POD development
Lines: 54
Organization: USP Designs
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-Original-NNTP-Posting-Host: rrba-146-126-231.telkomadsl.co.za
Message-ID: <42cbc801@forums-2-dub>
X-Original-Trace: 6 Jul 2005 05:01:05 -0700, rrba-146-126-231.telkomadsl.co.za
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 6 Jul 2005 05:01:06 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 6 Jul 2005 05:01:09 -0700
X-Trace: forums-1-dub 1120651269 10.22.108.75 (6 Jul 2005 05:01:09 -0700)
X-Original-Trace: 6 Jul 2005 05:01:09 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:448
Article PK: 17687

OK OK OK here is my code
static PODSString SendFileObjectGetimagelist(PODSObject *podsObj, PODSString
filedir)
{
SendFileObject *self = (SendFileObject *)podsObj;
HANDLE fileHandle;
TCHAR wrote[200];
PODSString ret;
ULValue val;
//_WIN32_FIND_DATAW *FindFileData = new _WIN32_FIND_DATAW;
WIN32_FIND_DATA FindFileData;
if (0 == strcmp(filedir, "Avantgo"))
{
CreateDirectory(L"program files\\avantgo\\images", NULL);
fileHandle = FindFirstFile(TEXT ("\\Program
files\\AvantGo\\images\\*.jpg"),&FindFileData);
}else{
fileHandle = FindFirstFile(TEXT ("\\My Documents\\My
Pictures\\*.jpg"),&FindFileData);
}


if (fileHandle == INVALID_HANDLE_VALUE)
{
wsprintf(wrote, L"%s","No_Files_Found");
}else{
wsprintf(wrote, L"%s", FindFileData.cFileName );
while (FindNextFile( fileHandle,&FindFileData ) != 0)
{
wsprintf(wrote, L"%s%s%s",wrote," ",FindFileData.cFileName );
}

}

FindClose(fileHandle);
MessageBox( NULL, wrote, L"Info", MB_OK );
ret = (const char *) wrote;
return ret;
}

"Robert" <robert@cyberprop.com> wrote in message
news:42cbc74f@forums-2-dub...
> Writting a pod to return list of images in a directory.
> I cannot see why only the first letter of the string "wrote" is returned.
> If there are no files "No_files_found" is returned correctly but if images
> exist only the first letter is returned
>
> I think it has to do with the casting of wrote into the PODSString ret.
> Any help appreciated
> Thanks
>
>


Enrico Pallazzo Posted on 2005-07-06 13:23:11.0Z
From: "Enrico Pallazzo" <enricopallazzo@myway.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <42cbc74f@forums-2-dub> <42cbc801@forums-2-dub>
Subject: Re: POD development
Lines: 70
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response
X-Original-NNTP-Posting-Host: vpn-dub-095.sybase.com
Message-ID: <42cbdb36$1@forums-2-dub>
X-Original-Trace: 6 Jul 2005 06:23:02 -0700, vpn-dub-095.sybase.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 6 Jul 2005 06:23:03 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 6 Jul 2005 06:23:11 -0700
X-Trace: forums-1-dub 1120656191 10.22.108.75 (6 Jul 2005 06:23:11 -0700)
X-Original-Trace: 6 Jul 2005 06:23:11 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:449
Article PK: 8877

Well there are couple things wrong. You are returning a stack variable
(wrote) from you function, its amazing you see anything at all. Allocate
your string on the heap that you return. Don't forget to free the string you
create in the destroy method. Also

wsprintf(wrote, L"%s%s%s",wrote," ",FindFileData.cFileName );

may work with some sprintf implementations, but its bad practice. You
shouldn't read and write to the same string using sprintf.

"Robert" <robert@cyberprop.com> wrote in message
news:42cbc801@forums-2-dub...
> OK OK OK here is my code
> static PODSString SendFileObjectGetimagelist(PODSObject *podsObj,
> PODSString filedir)
> {
> SendFileObject *self = (SendFileObject *)podsObj;
> HANDLE fileHandle;
> TCHAR wrote[200];
> PODSString ret;
> ULValue val;
> //_WIN32_FIND_DATAW *FindFileData = new _WIN32_FIND_DATAW;
> WIN32_FIND_DATA FindFileData;
> if (0 == strcmp(filedir, "Avantgo"))
> {
> CreateDirectory(L"program files\\avantgo\\images", NULL);
> fileHandle = FindFirstFile(TEXT ("\\Program
> files\\AvantGo\\images\\*.jpg"),&FindFileData);
> }else{
> fileHandle = FindFirstFile(TEXT ("\\My Documents\\My
> Pictures\\*.jpg"),&FindFileData);
> }
>
>
> if (fileHandle == INVALID_HANDLE_VALUE)
> {
> wsprintf(wrote, L"%s","No_Files_Found");
> }else{
> wsprintf(wrote, L"%s", FindFileData.cFileName );
> while (FindNextFile( fileHandle,&FindFileData ) != 0)
> {
> wsprintf(wrote, L"%s%s%s",wrote," ",FindFileData.cFileName );
> }
>
> }
>
> FindClose(fileHandle);
> MessageBox( NULL, wrote, L"Info", MB_OK );
> ret = (const char *) wrote;
> return ret;
> }
>
> "Robert" <robert@cyberprop.com> wrote in message
> news:42cbc74f@forums-2-dub...
>> Writting a pod to return list of images in a directory.
>> I cannot see why only the first letter of the string "wrote" is returned.
>> If there are no files "No_files_found" is returned correctly but if
>> images exist only the first letter is returned
>>
>> I think it has to do with the casting of wrote into the PODSString ret.
>> Any help appreciated
>> Thanks
>>
>>
>
>


Robert Posted on 2005-07-07 06:57:01.0Z
Reply-To: "Robert" <robert@cyberprop.com>
From: "Robert" <robert@cyberprop.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <42cbc74f@forums-2-dub> <42cbc801@forums-2-dub> <42cbdb36$1@forums-2-dub>
Subject: Re: POD development
Lines: 82
Organization: USP Designs
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-Original-NNTP-Posting-Host: rrba-146-81-14.telkomadsl.co.za
Message-ID: <42ccd23b@forums-2-dub>
X-Original-Trace: 6 Jul 2005 23:56:59 -0700, rrba-146-81-14.telkomadsl.co.za
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 6 Jul 2005 23:56:59 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 6 Jul 2005 23:57:01 -0700
X-Trace: forums-1-dub 1120719421 10.22.108.75 (6 Jul 2005 23:57:01 -0700)
X-Original-Trace: 6 Jul 2005 23:57:01 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:450
Article PK: 8881

Please understand I am a FoxPro programmer tring to make the pod work.My C++
knowledge is limited to the help file.
I have no idea what you are talking about -- sting on a heap???
have you go a sample of what this sould look like
Thanks

"Enrico Pallazzo" <enricopallazzo@myway.com> wrote in message
news:42cbdb36$1@forums-2-dub...
>
> Well there are couple things wrong. You are returning a stack variable
> (wrote) from you function, its amazing you see anything at all. Allocate
> your string on the heap that you return. Don't forget to free the string
> you create in the destroy method. Also
>
> wsprintf(wrote, L"%s%s%s",wrote," ",FindFileData.cFileName );
>
> may work with some sprintf implementations, but its bad practice. You
> shouldn't read and write to the same string using sprintf.
>
>
> "Robert" <robert@cyberprop.com> wrote in message
> news:42cbc801@forums-2-dub...
>> OK OK OK here is my code
>> static PODSString SendFileObjectGetimagelist(PODSObject *podsObj,
>> PODSString filedir)
>> {
>> SendFileObject *self = (SendFileObject *)podsObj;
>> HANDLE fileHandle;
>> TCHAR wrote[200];
>> PODSString ret;
>> ULValue val;
>> //_WIN32_FIND_DATAW *FindFileData = new _WIN32_FIND_DATAW;
>> WIN32_FIND_DATA FindFileData;
>> if (0 == strcmp(filedir, "Avantgo"))
>> {
>> CreateDirectory(L"program files\\avantgo\\images", NULL);
>> fileHandle = FindFirstFile(TEXT ("\\Program
>> files\\AvantGo\\images\\*.jpg"),&FindFileData);
>> }else{
>> fileHandle = FindFirstFile(TEXT ("\\My Documents\\My
>> Pictures\\*.jpg"),&FindFileData);
>> }
>>
>>
>> if (fileHandle == INVALID_HANDLE_VALUE)
>> {
>> wsprintf(wrote, L"%s","No_Files_Found");
>> }else{
>> wsprintf(wrote, L"%s", FindFileData.cFileName );
>> while (FindNextFile( fileHandle,&FindFileData ) != 0)
>> {
>> wsprintf(wrote, L"%s%s%s",wrote," ",FindFileData.cFileName );
>> }
>>
>> }
>>
>> FindClose(fileHandle);
>> MessageBox( NULL, wrote, L"Info", MB_OK );
>> ret = (const char *) wrote;
>> return ret;
>> }
>>
>> "Robert" <robert@cyberprop.com> wrote in message
>> news:42cbc74f@forums-2-dub...
>>> Writting a pod to return list of images in a directory.
>>> I cannot see why only the first letter of the string "wrote" is
>>> returned.
>>> If there are no files "No_files_found" is returned correctly but if
>>> images exist only the first letter is returned
>>>
>>> I think it has to do with the casting of wrote into the PODSString ret.
>>> Any help appreciated
>>> Thanks
>>>
>>>
>>
>>
>
>


Enrico Pallazzo Posted on 2005-07-07 12:46:02.0Z
From: "Enrico Pallazzo" <enricopallazzo@myway.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <42cbc74f@forums-2-dub> <42cbc801@forums-2-dub> <42cbdb36$1@forums-2-dub> <42ccd23b@forums-2-dub>
Subject: Re: POD development
Lines: 95
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vpn-dub-063.sybase.com
X-Original-NNTP-Posting-Host: vpn-dub-063.sybase.com
Message-ID: <42cd240a$1@forums-1-dub>
Date: 7 Jul 2005 05:46:02 -0700
X-Trace: forums-1-dub 1120740362 10.22.120.63 (7 Jul 2005 05:46:02 -0700)
X-Original-Trace: 7 Jul 2005 05:46:02 -0700, vpn-dub-063.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:451
Article PK: 8880

I think describing the difference between heap and stack memory is beyond
the scope of this newsgroup. For your specific example you have to use
malloc for any memory you return from the function and you have to keep
track of the pointer to that memory (a pointer is the address of memory
allocated by malloc) so that you can free the memory when the objects
destructor is called.

"Robert" <robert@cyberprop.com> wrote in message
news:42ccd23b@forums-2-dub...
> Please understand I am a FoxPro programmer tring to make the pod work.My
> C++ knowledge is limited to the help file.
> I have no idea what you are talking about -- sting on a heap???
> have you go a sample of what this sould look like
> Thanks
>
>
> "Enrico Pallazzo" <enricopallazzo@myway.com> wrote in message
> news:42cbdb36$1@forums-2-dub...
>>
>> Well there are couple things wrong. You are returning a stack variable
>> (wrote) from you function, its amazing you see anything at all. Allocate
>> your string on the heap that you return. Don't forget to free the string
>> you create in the destroy method. Also
>>
>> wsprintf(wrote, L"%s%s%s",wrote," ",FindFileData.cFileName );
>>
>> may work with some sprintf implementations, but its bad practice. You
>> shouldn't read and write to the same string using sprintf.
>>
>>
>> "Robert" <robert@cyberprop.com> wrote in message
>> news:42cbc801@forums-2-dub...
>>> OK OK OK here is my code
>>> static PODSString SendFileObjectGetimagelist(PODSObject *podsObj,
>>> PODSString filedir)
>>> {
>>> SendFileObject *self = (SendFileObject *)podsObj;
>>> HANDLE fileHandle;
>>> TCHAR wrote[200];
>>> PODSString ret;
>>> ULValue val;
>>> //_WIN32_FIND_DATAW *FindFileData = new _WIN32_FIND_DATAW;
>>> WIN32_FIND_DATA FindFileData;
>>> if (0 == strcmp(filedir, "Avantgo"))
>>> {
>>> CreateDirectory(L"program files\\avantgo\\images", NULL);
>>> fileHandle = FindFirstFile(TEXT ("\\Program
>>> files\\AvantGo\\images\\*.jpg"),&FindFileData);
>>> }else{
>>> fileHandle = FindFirstFile(TEXT ("\\My Documents\\My
>>> Pictures\\*.jpg"),&FindFileData);
>>> }
>>>
>>>
>>> if (fileHandle == INVALID_HANDLE_VALUE)
>>> {
>>> wsprintf(wrote, L"%s","No_Files_Found");
>>> }else{
>>> wsprintf(wrote, L"%s", FindFileData.cFileName );
>>> while (FindNextFile( fileHandle,&FindFileData ) != 0)
>>> {
>>> wsprintf(wrote, L"%s%s%s",wrote," ",FindFileData.cFileName );
>>> }
>>>
>>> }
>>>
>>> FindClose(fileHandle);
>>> MessageBox( NULL, wrote, L"Info", MB_OK );
>>> ret = (const char *) wrote;
>>> return ret;
>>> }
>>>
>>> "Robert" <robert@cyberprop.com> wrote in message
>>> news:42cbc74f@forums-2-dub...
>>>> Writting a pod to return list of images in a directory.
>>>> I cannot see why only the first letter of the string "wrote" is
>>>> returned.
>>>> If there are no files "No_files_found" is returned correctly but if
>>>> images exist only the first letter is returned
>>>>
>>>> I think it has to do with the casting of wrote into the PODSString ret.
>>>> Any help appreciated
>>>> Thanks
>>>>
>>>>
>>>
>>>
>>
>>
>
>