Changes between Version 22 and Version 23 of Docs/Prog/Manual/ApplicationLibraries/lib825ev/File/CFile


Ignore:
Timestamp:
03/12/25 08:05:05 (4 weeks ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/Prog/Manual/ApplicationLibraries/lib825ev/File/CFile

    v22 v23  
    77== Constructors ==
    88
    9 {{{
     9{{{#!c++
    1010CFile(void);
    1111CFile(const string& strFilename);
     
    3030==== Examples ====
    3131
    32 {{{
     32{{{#!c++
    3333CFile fileLog("/mnt/fl1/log.txt", "a");
    3434if(fileLog.IsOpen())
     
    3939}}}
    4040
    41 {{{
     41{{{#!c++
    4242CFile fileLog("/mnt/fl1/log.txt");
    4343}}}
     
    4949Opens a specified file, or using the filename already stored in the object.
    5050
    51 {{{
     51{{{#!c++
    5252bool Open(const string& strFilename, const string& strMode);
    5353bool Open(const string& strFilename, const char* pszMode);
     
    7171==== Example ====
    7272
    73 {{{
     73{{{#!c++
    7474CFile file;
    7575if(file.Open("/tmp/tmpfile", "w") == false)
     
    8282=== Close ===
    8383Closes the file
    84 {{{
     84{{{#!c++
    8585void Close(void);
    8686}}}
     
    100100==== Example ====
    101101
    102 {{{
     102{{{#!c++
    103103CFile file("/dev/ttyS1", "w");
    104104file.Print("This is a test\r\n");
     
    109109=== SetSerial ===
    110110Set the baud rate, number of data bits, parity, and number of stop bits for serial ports.
    111 {{{
     111{{{#!c++
    112112bool SetSerial(baud_index baud, data_bit_index = data8, parity_index = parityNone, stop_bit_index = stopOne);
    113113}}}
     
    127127==== Examples ====
    128128
    129 {{{
     129{{{#!c++
    130130CFile file("/dev/ttyS1", "w");
    131131if(file.IsOpen())
     
    135135}}}
    136136
    137 {{{
     137{{{#!c++
    138138CFile file("/dev/ttyS1", "w");
    139139if(file.IsOpen())
     
    145145=== ReadLine ===
    146146Reads a text file a line at a time.
    147 {{{
     147{{{#!c++
    148148bool ReadLine(string& strLine);
    149149}}}
     
    161161==== Example ====
    162162
    163 {{{
     163{{{#!c++
    164164CFile file("/mnt/nand/apps/test/config.txt", "r");
    165165if(file.IsOpen())
     
    179179=== DeleteFile ===
    180180Deletes a file
    181 {{{
     181{{{#!c++
    182182static bool DeleteFile(const string& strFilename);
    183183static bool DeleteFile(const char* pszFilename);
     
    198198==== Examples ====
    199199
    200 {{{
     200{{{#!c++
    201201string str = "/tmp/tmpfile";
    202202CFile::DeleteFile(str);
    203203}}}
    204204
    205 {{{
     205{{{#!c++
    206206if(CFile::DeleteFile("/tmp/tmpfile") == false)
    207207{
     
    210210}}}
    211211
    212 {{{
     212{{{#!c++
    213213CFile file("/tmp/tmpfile", "w");
    214214if(file.IsOpen())
     
    223223=== IsOpen ===
    224224Check whether the file is open
    225 {{{
     225{{{#!c++
    226226bool IsOpen(void)
    227227}}}
     
    238238==== Example ====
    239239
    240 {{{
     240{{{#!c++
    241241CFile file("/tmp/tmpfile", "w");
    242242if(file.IsOpen() == false)
     
    248248=== IsReady ===
    249249Check the state of the serial CTS input
    250 {{{
     250{{{#!c++
    251251bool IsReady(void);
    252252}}}
     
    265265==== Example ====
    266266
    267 {{{
     267{{{#!c++
    268268CFile fileLogOutput("/dev/ttyS1", "w");
    269269if(fileLogOutput.IsOpen())
     
    281281Set the state of the serial RTS output
    282282
    283 {{{
     283{{{#!c++
    284284bool SetRTS(bool bRTSOn = true);
    285285}}}
     
    297297==== Example ====
    298298
    299 {{{
     299{{{#!c++
    300300CFile fileLogOutput("/dev/ttyS1", "w");
    301301fileLogOutput.SetRTS(true);
     
    307307Get the file handle of the member FILE.
    308308
    309 {{{
     309{{{#!c++
    310310FILE* GetFile(void);
    311311}}}
     
    320320==== Example ====
    321321
    322 {{{
     322{{{#!c++
    323323CFile file("/tmp/test", "w");
    324324if(file.IsOpen())
     
    332332=== Print ===
    333333Outputs text which may include format specifiers. For each format specifier an additional parameter must be provided.
    334 {{{
     334{{{#!c++
    335335void Print(const string& strFormat, ...);
    336336void Print(const char* pszFormat, ...);
     
    353353
    354354==== Examples ====
    355 {{{
     355{{{#!c++
    356356string str = "Hello World\r\n";
    357357file.Print(str);
    358358}}}
    359359
    360 {{{
     360{{{#!c++
    361361int n = 5;
    362362string str = "ABC";
     
    364364}}}
    365365
    366 {{{
     366{{{#!c++
    367367// This is a function to log update data to two devices
    368368// g_fileLog1, and g_fileLog2 are globals that should already have been opened before this function is called.
     
    382382=== SetNonBlocking ===
    383383Set the file to not wait for data to arrive when reading.
    384 {{{
     384{{{#!c++
    385385void SetNonBlocking(void);
    386386}}}
     
    400400==== Example ====
    401401
    402 {{{
     402{{{#!c++
    403403CFile fileComm("/dev/ttyS0", "r");
    404404if(fileComm.IsOpen())
     
    411411=== Read ===
    412412Reads a binary block of data from a file.
    413 {{{
     413{{{#!c++
    414414bool Read(void *pData, size_t nSize);
    415415}}}
     
    430430=== Write ===
    431431Writes a binary block of data to a file.
    432 {{{
     432{{{#!c++
    433433bool Write(void *pData, size_t nSize);
    434434}}}
     
    448448=== GetBytesRead ===
    449449Returns how may bytes were read from previous Read function.
    450 {{{
     450{{{#!c++
    451451size_t GetBytesRead(void);
    452452}}}
     
    465465Returns how may bytes were written from previous Write function.
    466466
    467 {{{
     467{{{#!c++
    468468size_t GetBytesWritten(void);
    469469}}}
     
    481481=== Seek ===
    482482
    483 {{{
     483{{{#!c++
    484484bool Seek(long int offset, long int origin = SEEK_SET);
    485485}}}