I'm developing a simple Text Editor to understand better PocketC language, then I've done this:
#include "\\Storage Card\\My Documents\\PocketC\\Parrot\\defines.pc"
int filehandle;
int file_len;
string file_mode;
initComponents()
{
createctrl("EDIT", "test", 2, 1, 0, 24, 70, 25, TEXTBOX);
wndshow(TEXTBOX, SW_SHOW);
guigetfocus();
}
main()
{
filehandle = fileopen(OpenFileDlg("Plain Text Files (*.txt)|*.txt; All Files (*.*)|*.*"), 0, FILE_READWRITE);
file_len = filegetlen(filehandle);
if(filehandle = -1)
{
MessageBox("File Could Not Be Found!", "Error", 3, 1);
}
initComponents();
editset(TEXTBOX, fileread(filehandle, file_len));
}
Then I tried to run the application, it opens the Open File Dialog, I select a file(that is at \test.txt
) that I've created with notepad, then I got my MessageBox
saying that the file wans't found. Then I want to know why I'm getting this if the file is all correct?
*PS: When I click to exit the MessageBox
, I saw that the TextBox
is displaying where the file is(I've tested with many other files, and with all I got the error and this).