- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bothuses of the string szFileName(iPos1+1:iPos2-1)//' - Graph'C below compile OK, but not sure if the first construct is really legal. I believe that
loc(szFileName(iPos1+1:iPos2-1) is OK, but not sure aboutconcatenating the ' - Graph'C as part of the arg for loc(). If the first construct is legal,how does IVF handle the memory for the contatenated string? Is a new memory location created? Thanks for comments.
di%lpszDocName = loc(szFileName(iPos1+1:iPos2-1)//' - Graph'C)
or,
character(Max_Path) szName
szName = szFileName(iPos1+1:iPos2-1)//' - Graph'C)
di%lpszDocName = loc(szName)
Message Edited by halcyong@fcc.net on 02-28-2006 04:47 AM
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
However, the documentation does not discuss the lifetime of such stack variable (i.e. when the stack is erased). It's almost certainly OK to supply it as an argument to a function:
call SomeAPI(LOC(string1//string2))
I'm not so sure about the "intermediate" approach as you described it (assign it to a variable and pass it to an API shortly afterwards). Steve should be able to tell you better the important issue is whether the stack is cleaned up on the next line or when the containing routine ends my guess is the latter (in which case it's OK to reuse the returned address subsequently in the same routine), but it's better to be on the safe side in the meanwhile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to make sure I understand correctly:
di%lpszDocName = loc(str1//str2) is OK,
but incorrect to use di%lpszDocName in a subsequent statement because the addressmayhave been overwritten on the stack.
Thanks for the replies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page