[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1895
  • Last Modified:

Missing operator or semicolon - weird error - delphi

I have a very weird problem - I keep getting a missing operator or semi-colon error with a length function -
Here is the code:
      pBitmap.LoadFromFile(sFilename);
      pJPEG.Assign(pBitmap);
      pJPEG.CompressionQuality := 80;

      jpglen := Length(sFilename);
      tempjpg := LeftStr(sFilename, jpglen - 4);

      if FileExists(tempjpg) then
        DeleteFile(tempjpg);

If I comment out the jpglen := Length(sFilename) it works fine //sFilename is defined as string and populated earlier
Usually I know it is missing a semi colon on the line above - but as you can see that is not the case here.  I originally had the length function inline in the setting for tempjpg, but then that line failed, which I broke it out to determine where the issue was.  If I set the jpglen to an integer value it will compile with no issues...  
Any help is appreciated - I do not know why it is giving me this error on a length function...
0
Chipmunk77
Asked:
Chipmunk77
  • 2
1 Solution
 
diniludCommented:
Check Like this

   pBitmap.LoadFromFile(sFilename);
      pJPEG.Assign(pBitmap);
      pJPEG.CompressionQuality := 80;

      jpglen := System.Length(sFilename);
      tempjpg := LeftStr(sFilename, jpglen - 4);

      if FileExists(tempjpg) then
        DeleteFile(tempjpg);
0
 
Chipmunk77Author Commented:
Thanks!  I never thought of adding the system there...  :-)
I tried adding it to the uses clause but it kept telling me it was already there - even though it wasn't

Just for pure curiousity sake - any idea why it needs to be fully qualified?
0
 
diniludCommented:
i think there is a function with Name Length.
you put only length function.
right click on Length function and find declaration.
then you will identify what is the reason.


sorry for my bad english
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now