7 #include "osl/diagnose.h"
8 #include "rtl/ustring.h"
9 #include "rtl/byteseq.h"
14 int main (int argc
, char ** argv
)
19 oslFileHandle hFile
= 0;
21 rtl_uString
* pSystemPath
= 0;
22 rtl_uString
* pFileUrl
= 0;
24 rtl_uString_newFromAscii (&pSystemPath
, argv
[1]);
26 result
= osl_getFileURLFromSystemPath (pSystemPath
, &pFileUrl
);
27 rtl_uString_release (pSystemPath
), pSystemPath
= 0;
28 if (result
!= osl_File_E_None
)
31 result
= osl_openFile (pFileUrl
, &hFile
, osl_File_OpenFlag_Read
);
32 rtl_uString_release (pFileUrl
), pFileUrl
= 0;
33 if (result
== osl_File_E_None
)
35 sal_Sequence
* pBuffer
= 0;
40 result
= osl_readLine (hFile
, &pBuffer
);
41 if (result
!= osl_File_E_None
)
44 if (pBuffer
->elements
[0] == 0)
45 /* @@@ cannot distinguish empty line from EOF @@@ */
48 for (i
= 0, n
= pBuffer
->nElements
; i
< n
; i
++)
49 printf ("%c", (char)(pBuffer
->elements
[i
]));
53 rtl_byte_sequence_release (pBuffer
), pBuffer
= 0;
54 (void) osl_closeFile (hFile
);