Difference between revisions of "Rosetta Stone"

From Free Pascal wiki
Jump to navigationJump to search
(Helps people familiar with performing tasks in other languages/environments to find FPC/Lazarus equivalents)
 
m (layout mainly)
Line 9: Line 9:
  
 
Some useful pages:  
 
Some useful pages:  
[http://mc-computing.com/Languages/] This page has some explanation of the concepts involved
+
* [http://mc-computing.com/Languages/ http://mc-computing.com/Languages/] This page has some explanation of the concepts involved
[http://rosettacode.org/wiki/Category:Pascal] A huge amount of languages, even esoteric, and tasks make this site special
+
* [http://rosettacode.org/wiki/Category:Pascal http://rosettacode.org/wiki/Category:Pascal] A huge amount of languages, even esoteric, and tasks make this site special
  
 
== Operating systems ==
 
== Operating systems ==
Line 24: Line 24:
 
| copy||cp||Copy file||Lazarus fileutil.copyfile; roll your own with filestreams
 
| copy||cp||Copy file||Lazarus fileutil.copyfile; roll your own with filestreams
 
|-
 
|-
| del, erase||rm||Delete file||sysutils.deletefile, erase
+
| del, erase||rm, rm -f||Delete file||sysutils.deletefile, erase
 
|-
 
|-
| deltree, rmdir /s||rm -r ||Remove directories with subdirectories||Lazarus fileutil.deletedirectory
+
| deltree, rmdir /s||rm -r,rm -rf ||Remove directories with subdirectories||Lazarus fileutil.deletedirectory
 
|-
 
|-
 
| dir||ls||Find files in a directory||Lazarus FindAllFiles  
 
| dir||ls||Find files in a directory||Lazarus FindAllFiles  

Revision as of 14:42, 12 February 2012

Introduction

Often, people new to a programming language/library have trouble mapping the things they know how to do in other environments to the new environments.

It can be handy to have a sort of "Rosetta stone" that roughly translates tasks from one environment/language into another.

Programming languages

If you have experience in other programming languages (such as C++, Visual Basic), there are some Rosetta stone web pages that might help you. As FreePascal/Lazarus syntax and library is fairly consistent with Delphi's, sites that "translate" to Delphi are also a valuable resource.

Some useful pages:

Operating systems

If you know how to do something in an operating system, chances are you can do the same with FPC/Lazarus.

The table below gives a rough mapping of some tasks:

Windows/DOS Unix/Linux Description FreePascal/Lazarus
copy cp Copy file Lazarus fileutil.copyfile; roll your own with filestreams
del, erase rm, rm -f Delete file sysutils.deletefile, erase
deltree, rmdir /s rm -r,rm -rf Remove directories with subdirectories Lazarus fileutil.deletedirectory
dir ls Find files in a directory Lazarus FindAllFiles
mkdir mkdir Create directory mkdir; forcedirectories (creates entire path, if necessary)
move mv Move file to another directory Within partition/disk: sysutils.renamefile; otherwise copy and delete original
rename, ren mv Rename file sysutils.renamefile (can also \"move\" file between directories, but only on same partition/disk
wget, curl wget, curl Download file from HTTP/FTP Multiple optons, e.g. use synapse httpsend or ftpsend units