Skip to content
Browse files

Merge pull request #1176 from kmsquire/doc_updates

Updated `cstring` to `bytestring` in manual.
  • Loading branch information...
2 parents 4f69289 + 4326b6e commit 856b3b65672cefac836fb03bee6cb15ba743162e @Keno Keno committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 doc/manual/calling-c-and-fortran-code.rst
8 doc/manual/calling-c-and-fortran-code.rst
@@ -82,7 +82,7 @@ of an environment variable, one makes a call like this:
julia> path = ccall(dlsym(libc, :getenv), Ptr{Uint8}, (Ptr{Uint8},), "SHELL")
Ptr{Uint8} @0x00007fff5fbfd670
- julia> cstring(path)
+ julia> bytestring(path)
Note that the argument type tuple must be written as ``(Ptr{Uint8},)``,
@@ -111,11 +111,11 @@ in
function getenv(var::String)
val = ccall(dlsym(libc, :getenv),
- Ptr{Uint8}, (Ptr{Uint8},), cstring(var))
+ Ptr{Uint8}, (Ptr{Uint8},), bytestring(var))
if val == C_NULL
error("getenv: undefined variable: ", var)
- cstring(val)
+ bytestring(val)
The C ``getenv`` function indicates an error by returning ``NULL``, but
@@ -142,7 +142,7 @@ machine's hostname:
ccall(dlsym(libc, :gethostname), Int32,
(Ptr{Uint8}, Ulong),
hostname, length(hostname))
- return cstring(convert(Ptr{Uint8}, hostname))
+ return bytestring(convert(Ptr{Uint8}, hostname))
This example first allocates an array of bytes, then calls the C library

0 comments on commit 856b3b6

Please sign in to comment.
Something went wrong with that request. Please try again.