Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Linux
»
[Solved] C open() function in Lazarus?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Dialog ShowModal and an i...
by
d7_2_laz
[
Today
at 09:51:39 pm]
JEDI error but unit compi...
by
Thaddy
[
Today
at 09:30:33 pm]
Poll: Watches and Display...
by
Martin_fr
[
Today
at 09:22:47 pm]
Understanding and adjusti...
by
circular
[
Today
at 09:09:56 pm]
how to search in rxmemory...
by
rcmz
[
Today
at 08:45:16 pm]
Controlling the behavior ...
by
wp
[
Today
at 08:29:28 pm]
Offical launch of the 1 B...
by
Gustavo 'Gus' Carreno
[
Today
at 08:21:29 pm]
how to change the color f...
by
wp
[
Today
at 07:23:58 pm]
Dynarray initialization p...
by
Thaddy
[
Today
at 06:30:12 pm]
Project fails on run but ...
by
dseligo
[
Today
at 05:30:42 pm]
Zeos components. Had to c...
by
Fantablup
[
Today
at 04:17:13 pm]
[SOLVED] Completion box s...
by
furious programming
[
Today
at 04:12:26 pm]
[LAMW] How to create a ca...
by
af0815
[
Today
at 03:48:16 pm]
Complex package installat...
by
wp
[
Today
at 03:38:16 pm]
A "leisure" question on W...
by
gidesa
[
Today
at 03:17:10 pm]
Curling Pythagoras Tree: ...
by
AlexTP
[
Today
at 03:07:53 pm]
[SOLVED] Combined pointer...
by
CM630
[
Today
at 02:48:41 pm]
Using KeyPress event, how...
by
Zvoni
[
Today
at 02:24:42 pm]
a Unit problem?
by
Thaddy
[
Today
at 01:56:12 pm]
Any upgrades to fpWeb pag...
by
marcov
[
Today
at 12:50:25 pm]
Help needed with Cairo / ...
by
Roland57
[
Today
at 12:25:16 pm]
Configure JCF messages
by
DomingoGP
[
Today
at 11:26:55 am]
IDE instability on Raspbe...
by
rvk
[
Today
at 10:37:14 am]
Boleeman's projects are p...
by
AlexTP
[
Today
at 10:18:04 am]
Your best UI design - con...
by
circular
[
Today
at 09:36:11 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [Solved] C open() function in Lazarus? (Read 3304 times)
Edson
Hero Member
Posts: 1301
[Solved] C open() function in Lazarus?
«
on:
December 04, 2016, 04:53:06 am »
Can someone tell me please, if there is (and what is) some equivalent in fpc/lazarus, to the system C function open()?
It's declared something like: int open (const char *__file, int __oflag, ...)
I need to port a C code in linux OS.
«
Last Edit: December 05, 2016, 03:56:11 am by Edson
»
Logged
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10
derek.john.evans
Guest
Re: C open() function in Lazarus?
«
Reply #1 on:
December 04, 2016, 05:11:39 am »
In SysUtils; FileOpen/FileClose/FileRead/FileWrite
http://www.freepascal.org/docs-html/rtl/sysutils/fileopen.html
Are close to 100% compatible.
Logged
skalogryz
Global Moderator
Hero Member
Posts: 2770
Re: C open() function in Lazarus?
«
Reply #2 on:
December 04, 2016, 05:14:20 am »
Quote from: Edson on December 04, 2016, 04:53:06 am
I need to port a C code in linux OS.
Lots of unix (linux) functions are fp- prefixed are declared in BaseUnix / Unix units.
If you're not planning to target Windows in future (or writing unix specific) you could use whose!
For example C open() is
fpopen
in freepascal.
Logged
Thaddy
Hero Member
Posts: 14205
Probably until I exterminate Putin.
Re: C open() function in Lazarus?
«
Reply #3 on:
December 04, 2016, 08:20:21 am »
I think you are not referring to a C Open() function perse, but to the unix fs open(). That's indeed as skalogryz wrote simply
Code: Pascal
[Select]
[+]
[-]
FpOpen
(
'/path/to/device/file'
)
;
Note that FileOpen/FileClose/FileRead/FileWrite are cross platform, indeed, but under unix happen to use the FP prefixed functions from ./rtl/baseunix.pp like the above.
Filestreams do the same.
«
Last Edit: December 04, 2016, 08:28:24 am by Thaddy
»
Logged
Specialize a type, not a var.
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Linux
»
[Solved] C open() function in Lazarus?
TinyPortal
© 2005-2018