Wiki Page Content

Differences between revisions 2 and 3
Revision 2 as of 2010-06-16 23:47:00
Size: 2559
Editor: SheenaSmith
Comment: add remarks
Revision 3 as of 2010-06-17 00:12:24
Size: 2455
Editor: SheenaSmith
Comment: remove struct link
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
Use this function to create [[SDL_RWops]] structures from files. Use this function to create SDL_RWops structures from files.
Line 17: Line 17:
||'''file'''||^a pointer to the file containing the information to fill an [[SDL_RWops]] structure with^||
||'''mode'''||^a pointer to the mode to be used for/in the [[SDL_RWops]] structure^; see [[#Remarks|Remarks]] for details||
||'''file'''||^a pointer to the file containing the information to fill an SDL_RWops structure with^||
||'''mode'''||^a pointer to the mode to be used for/in the SDL_RWops structure^; see [[#Remarks|Remarks]] for details||
Line 21: Line 21:
A pointer to the [[SDL_RWops]] structure that is created, *or NULL on failure*. A pointer to the SDL_RWops structure that is created, *or NULL on failure*.
Line 29: Line 29:
<<Color2(green,The remarks are taken from the old wiki. Are they still applicable?)>>

Available '''mode''' strings:
*Available '''mode''' strings:
Line 39: Line 37:
NOTE: In order to open a file as a binary file, a "b" character has to be included in the '''mode''' string. This additional "b" character can either be appended at the end of the string (thus making the following compound modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+"). Additional characters may follow the sequence, although they should have no effect. For example, "t" is sometimes appended to make explicit the file is a text file. NOTE: In order to open a file as a binary file, a "b" character has to be included in the '''mode''' string. This additional "b" character can either be appended at the end of the string (thus making the following compound modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+"). Additional characters may follow the sequence, although they should have no effect. For example, "t" is sometimes appended to make explicit the file is a text file. *

DRAFT

SDL_RWFromFile

Use this function to create SDL_RWops structures from files.

Syntax

SDL_RWops* SDL_RWFromFile(const char* file,
                          const char* mode)

Function Parameters

file

a pointer to the file containing the information to fill an SDL_RWops structure with

mode

a pointer to the mode to be used for/in the SDL_RWops structure; see Remarks for details

Return Value

A pointer to the SDL_RWops structure that is created, *or NULL on failure*.

Code Examples

You can add your code example here

Remarks

*Available mode strings:

r

Open a file for reading. The file must exist.

w

Create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.

a

Append to a file. Writing operations append data at the end of the file. The file is created if it does not exist.

r+

Open a file for update both reading and writing. The file must exist.

w+

Create an empty file for both reading and writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.

a+

Open a file for reading and appending. All writing operations are performed at the end of the file, protecting the previous content to be overwritten. You can reposition (fseek, rewind) the internal pointer to anywhere in the file for reading, but writing operations will move it back to the end of file. The file is created if it does not exist.

NOTE: In order to open a file as a binary file, a "b" character has to be included in the mode string. This additional "b" character can either be appended at the end of the string (thus making the following compound modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+"). Additional characters may follow the sequence, although they should have no effect. For example, "t" is sometimes appended to make explicit the file is a text file. *


CategoryAPI, CategoryIO

None: SDL_RWFromFile (last edited 2016-05-12 20:32:05 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit