If my code had included all the error handling it wouldn't have been short.Edward-san wrote:no checks for fopen possibly returning nullptr? Cat exterminator!
PS. You missed the two other cat-killing features.
If my code had included all the error handling it wouldn't have been short.Edward-san wrote:no checks for fopen possibly returning nullptr? Cat exterminator!

Sorry.Gez wrote:I lost too many cats to find this joke funny.
I beat one cookie your fopen file is better than minedpJudas wrote: Plus I'd never have used fopen in a serious project because it has no proper unicode support and needs to be wrapped by a RAII class.
Code: Select all
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.Downloads;
openPicker.FileTypeFilter.Add(".csv");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
var read = await FileIO.ReadTextAsync(file);
string TextBuffer = read;
}

What alternative is there when targeting multiple platforms? For this reason I actually have written a wrapper which on Unix-likes wraps fopen and on Windows wraps _wfopen. I don't know what these C standards guys had been smoking when they decided something as essential as opening a file does not need a proper system independent implementation for Unicode.dpJudas wrote:If my code had included all the error handling it wouldn't have been short.Edward-san wrote:no checks for fopen possibly returning nullptr? Cat exterminator!Plus I'd never have used fopen in a serious project because it has no proper unicode support and needs to be wrapped by a RAII class.