Tuesday, March 29, 2022

Golang Windows 10 initial settings

1) 

https://osdn.net/projects/mingw/


2)

https://go.dev/dl/


https://go.dev/dl/go1.18.windows-386.msi


3)

Environment variables:


GOPATH %USERPROFILE%\go;C:\go

PATH %USERPROFILE%\go\bin;C:\MinGW\bin\;c:\go\bin;C:\MinGW\


4)

https://code.visualstudio.com/



5) Install GO plugins for VSC

  #include <stdio.h>
  #include <sqlite3.h>
 
  static int callback(void *NotUsed, int argc, char **argv, char **azColName){
    int i;
    for(i=0; i<argc; i++){
      printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
    }
    printf("\n");
    return 0;
  }
 
  int main(int argc, char **argv){
    sqlite3 *db;
    char *zErrMsg = 0;
    int rc;
 
    if( argc!=3 ){
      fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
      return(1);
    }
    rc = sqlite3_open(argv[1], &db);
    if( rc ){
      fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
      sqlite3_close(db);
      return(1);
    }
    rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
    if( rc!=SQLITE_OK ){
      fprintf(stderr, "SQL error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
    }
    sqlite3_close(db);
    return 0;
  }

https://www.oazazdravlja.rs/novosti/16-kurkuma-cudotvorac


#include<stdio.h>
#include<stdlib.h>


//int main(int argc, char* argv[])
int main()
{

char const* const fileName = "ulaz.txt";

FILE* file = fopen(fileName, "r");

if(!file){
printf("\n Unable to open : %s ", fileName);
return -1;
}

    char line[500];

    char str[50];
    FILE *fp;
    fp = fopen("izlaz.txt", "w");

    if(fp == NULL)
    {
        printf("Error opening file\n");
        exit(1);
    }

 
while (fgets(line, sizeof(line), file)) {
        printf("%s", line);
//        fputs(str, fp);
        fputs(line, fp);

    }

    fclose(fp);
    fclose(file);
    return 0;
}

No comments:

Post a Comment

Коментар: