Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need some C++ APIs

Featured Replies

Posted

Hi again,

short question.Just need to know which APIs I have to use to get the filesize by handle and a C++ API to delete the file if the filesize was 0 etc you know.So I use fopen to create a file then fwrite to write bytes into file (if so) and now I need a C++ API for GetFileSize API & DeleteFile API.So I can't use the same handle from fopen API with GetFileSize API you know.DeleteFile API is ok so far so this only need a path to file.

Thanks

#include <cstdio>
int main() {
 
    const int result = remove("C:\\Temp\\somefile.txt");
    return 0;
}
Quote

I use fopen to create a file then fwrite to write bytes into file

Here, you work by pointer... and you can get file size like this:

#include <stdio.h>
int main() {
    FILE* lpFile;
    lpFile = fopen("empty.txt","r");
    if (lpFile != NULL)  {
        fseek(lpFile, 0, SEEK_END);
        int fileSize = ftell(lpFile);
        printf("FileSize is: %u\n", fileSize);
        fseek(lpFile, 0, SEEK_SET);
        fclose (lpFile);
    }
    getchar();
    return 0;
}

if you need to work by handle (GetFileSize), it's better to use CreateFile and WriteFile instead of fopen and fwrite...

  • Author

Hi guys,

thanks for your answers about it. :) As I said I just needed to know some C++ APIs about it I can use directly.Now it works so far on a first test.Thanks again.

PS: I am also no C++ coder and just use rarly such APIs etc.

greetz

@LCF-AT

Please Make tutorial

 

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.