pascal

Move() to Insert/Delete item(s) from a dynamic array of string

Using System.Move() to insert/delete item(s) from an array of string is not as easy as insert/delete it from other array of simple data types. The problem is ... string is reference counted in Delphi. Using Move() on reference-counted data types needs deeper knowledge on internal compiler behaviour. Can someone here explain the needed s...

Errors when using Lazarus IDE on OS X

I'm trying to use Lazarus for OS X to complete a PASCAL programming assignment, and for some reason, I keep getting the following debugger error. Debugger Error Ooops, the debugger entered the error state. Save your work now! Hit Stop, and hope the best, we're pulling the plug. Even though it tells me "Project successfu...

What language can I use instead of Turbo Pascal?

I was using Turbo Pascal for about 20 years, but now I have changed my computer, and I have Windows 7 now. TP does not work under it. What similar language can I use instead of TP, that will require from me to spend minimum possible time studying it. ...

Pascal: "or" not supported for types "Char"

Hey, I'm new here so sorry if I do something wrong! I'm making a simple Pascal program in Lazarus and I'm getting this error when compiling: HWE(16,18) Error: Operation "or" not supported for types "Char" and "Constant String" Here is the part it's complaining about: Repeat begin Readln(style); If style <> ('e' or 'mp' or 'sa') then...

Move up one line in console (Pascal)

Hey all. I'm sitting at college making a noughts and crosses game while everyone else is learning the basics of Pascal. I can print the 2D array denoting the board into the terminal just fine, but what I want to do is update the board everytime a player adds a nought or cross, or moves their cursor around. To do this, I want to over-wri...

Get integer portion of string in Pascal

I have a string Alpha 2 from which I need to extract the integer portion i.e. 2. This is a quick and dirty project and I'm not currently interested in learning Pascal. All I need is a quick answer! ...

Comments in Pascal

I have a compiler homework question that wants me to draw a DFA for Pascal comments, but I have never (and probably never will) use Pascal. The question does not specify if we should use ANSI Pascal or Turbo Pascal, so I was going to do one for both. Some Google searches showed me that Turbo Pascal allows nested comments as long as the...

How do I check if an array contains particular index in Pascal?

E.g. I have this array: type OptionRange = array[ 1..9 ] of integer; How do I check if array[x] exists? Actually, I want to limit user input with the array index. Am I doing the wrong thing? Is there a better practical solution? ...

Why this code doesn't works in Pascal?

I have this var: var UserInput : array [1..3] of string; I'm trying to set multiple values, at once. readln( UserInput[1], UserInput[2], UserInput[3] ); When the code runs, all the input is stored in UserInput[1] Ex.: Input: 10 1.5 18 Result: UserInput[1] = 10 1.5 18 UserInput[2] = 0 UserInput[3] = 0 What should I do? ...

Linked list in Pascal

Hi, Im looking for a good and simple implementation of a linked list in Pascal. As Im a Pascal beginner it would help me alot as a study material. Thanks for any tips. ...

How to convert a integer to float in Delphi?

Hi, How to convert a integer to float in Delphi? E.g int_h:= int_var/1.5* int_var; ...

How to resolve shift reduce conflicts in my grammar?

I'm writing a compiler from (reduced) Pascal into ARM asm. I'm at the second step of the process - after writing lexical analyzer now I'm working on syntax analysis with java cup. I have written my grammar, but got 5 S/R conflicts, which are all very similar. Example: Warning : *** Shift/Reduce conflict found in state #150 between a...

lazarus gui main menu using forms?

i need to make a form where when a button is clicked then another form/page opens and from that for you can return to the original form in a similar fashion a main menu/sub menu works. sorry im new to object pascal ...

Delete first N characters from TextFile without creating a new file (Delphi)

Hi! I just wanna to delete from specified text file first N characters, but i'm stuck. Help me please! procedure HeadCrop(const AFileName: string; const AHowMuch: Integer); var F: TextFile; begin AssignFile(F, AFileName); // what me to do next? // ... // if AHowMuch = 3 and file contains"Hello!" after all statements // it m...

How do I print a tab character in Pascal?

I'm trying to figure out in all the Internets what's the special character for printing a simple tab in Pascal. I have to format a table in a CLI program and that would be handy. ...

runerror(102) file not assigned?

begin reset(f); assignfile(f, 'data.txt'); Reset(f); found:= false; search := edit1.text ; repeat read(f, phone) ; read(f, cusfname); read(f, adress); found:= search = phone until eof(f) or found; if found then memo1.append(phone); memo1.append(cusfname); memo1.append(adress); closefile(f) ; if not found ...

Why we need Delphi prism

What is the need to use delphi prism instead of Visual studio; i am a delphi programmer so i like object pascal but what else are that delphi prism have that other does not have ...

Inno-Setup doesn't allow access to all registry keys, why ?

I use this code to know if a key exists or not : if RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Autodesk') then begin MsgBox('Key exists!!', mbInformation, MB_OK); end; for this exemple, it works, i have the message box, but with this it doesn't: if RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Autodesk\Maya') then begin ...