Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
returns integer not text
#1
i am trying to return the text string but it only returns numbers.

it should return, test.cpp  it returns 85752528 for some reason i cant figure out

thank you
 
Code:
Copy      Help
 out
str a= sub.t
out a

#sub t
str a =("C:\SierraChart\ACS_Source\test.cpp - Notepad++ [Administrator] Notepad++")

int b = findcr(a "\")+1
int c = findcr(a ".cpp")+4
str d
ret d.get(a b c-b )
#2
Add this line after "#sub t"
function~
#3
thank you!!  question. is that QM hieroglyphs or standard C++?

can you help me understand this....what does this mean?
the * after datatype & before variable?
the + in front of GetProp?  thanks

TBATC* t = +GetProp(hWnd "TBATC")
#4
I'm a newbie here also. I'm just picking things up here and there in the QM world only. So for your question I could answer the first part "is that QM hieroglyphs or standard C++?".

When you declare a sub by using "#sub <name>" keyword, you actually declare a subroutine or function. Usually most of the time in QM your "#sub <name>" function is doing some additional stuff and don't need to return anything. But in your case you need a return value.

So you have to know that by default the return type of a "#sub" or funtion is an integer. In your case you need a string. So you need to explicitly tell it to do that. In your case the return type of "string" is a tilda sign "~". That's why you see I've mentioned about it "function~". This is QM syntax and not C++ standard. Another straigtforward way is using this "function'str" for the string return type is okay too.

The function statement is optional. Use it when need parameters or when the function returns something (uses ret).

You could look up for more on function types in QM help doc.
#5
great thanks!


Forum Jump:


Users browsing this thread: 2 Guest(s)