示例#1
0
文件: ftell.cpp 项目: 0-wiz-0/coreclr
int __cdecl main(int argc, char *argv[])
{
    const char szFileName[] = {"testfile.txt"};
    long lPos = -1;
    int i;
    char szTempBuffer[256];
    struct TESTS testCase[] = 
    {
        {0, SEEK_SET, 0},
        {10, SEEK_CUR, 10},
        {-5, SEEK_CUR, 5},
        {-2, SEEK_END, 50}
    };
       


    if (0 != PAL_Initialize(argc,argv))
    {
        return FAIL;
    }

    memset(szTempBuffer, 0, 256);


    /* open the test file */
    pFile = fopen(szFileName, "r");
    if (pFile == NULL)
    {
        Fail("ftell: ERROR -> fopen failed to open the file \"%s\".\n");
    }

    /* loop through the test cases */
    for (i = 0; i < (sizeof(testCase)/sizeof(struct TESTS)); i++)
    {
        if (MovePointer(testCase[i].lDist, testCase[i].nFrom) != TRUE)
        {
            Fail("");
        }
        else if (Validate(testCase[i].lPosition) != TRUE)
        {
            Fail("");
        }
    }

    if (fclose(pFile) != 0)
    {
        Fail("ftell: ERROR -> fclose failed to close the file.\n");
    }

    /* lets just see if we can find out where we are in a closed stream... */
    if ((lPos = ftell(pFile)) != -1)
    {
        Fail("ftell: ERROR -> ftell returned a valid position (%ld) on a "
            "closed file handle\n", 
            lPos);
    }
    
    PAL_Terminate();
    return PASS;
}
示例#2
0
gboolean XButtonUp( GtkWidget *wid, GdkEventButton *event, gpointer data)
{
	if(((XWidget*)data)->event.Up.pChar>-1)
		MovePointer(((XWidget*)data)->event.Up);
}
示例#3
0
gboolean XButtonLeave( GtkWidget *wid, GdkEventButton *event, gpointer data)
{
	if(((XWidget*)data)->event.Leave.pChar>-1)
		MovePointer(((XWidget*)data)->event.Leave);
}
示例#4
0
gboolean XButtonPress( GtkWidget *wid, GdkEventButton *event, gpointer data)
{
	if(((XWidget*)data)->event.Press.pChar>-1)
		MovePointer(((XWidget*)data)->event.Press);
}
示例#5
0
gboolean XButtonClick( GtkWidget *wid, gpointer data)
{
	if(((XWidget*)data)->event.Click.pChar>-1)
		MovePointer(((XWidget*)data)->event.Click);
}
示例#6
0
void XCheckBoxToogle( GtkWidget *wid, gpointer data)
{
	if(((XWidget*)data)->event.Click.pChar>-1)
		MovePointer(((XWidget*)data)->event.Click);
}
示例#7
0
void XWindowClick(GtkWidget *wid, gpointer data)
{
	XWidget *w=(XWidget*)data;
	MovePointer(w->event.Click);
}