NO

Recent Posts

Pages: [1] 2 3 ... 10
1
Announcements / Сайт для Вас
« Last post by RandallErype on Today at 08:41:04 pm »
Мы можем помочь создать для Вашего дела сайт визитку в Вашем городе Вардане Краснодарского края?.
С гарантией сделаем, займется SEO в Яндекс, Гугл, соц. сетях пишите на seo-websait@yandex.ru
Работаем по Краснодарскому краю, все чаще у нас заказывают с Лабинске.
Звоните,  мы готовы сделать для Вашего бизнеса, качественный и самое главное не дорогой интернет ресурс для Вас и Вашего бизнеса. Кстати наш номер +7(967)665-46-33, +7(988)667-88-72
 
В основном ищут по запросу: 
создание сайтов краснодар недорого
 
Ждем Ваших заказов! И Готовы БЕСПЛАТНО проконсультировать.
 
Модераторы прошу прощения если пишу не в тему.
2
Beginner questions / Re: How to delete some Content in a File ?
« Last post by John1 on Yesterday at 12:50:22 pm »
Hello Grincheux,

What do you mean, with, some parts might be locked ?

The Strings in the File are not listed straight.

Sting one
  String two
  String three


But instead somewhere randomly.

String one
                                                      String two
                                                                                               String three


Perhaps this prevents the funciton to find and delete the Strings as well ?

In this Code it is deleted well, but not ever :

Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define file "test_str_del.txt"

char carV[256];

void deleteElement() {
 FILE *fp;
    char value[256];
value[strcspn(value, "\r\n")] = 0;  // new add, instead "s" now it is "val"
printf("Data to delete :  ");
    if(fgets(value,sizeof(value),stdin) == NULL) { // new add
     printf("Wrong Input\n");     
            } 


fp = fopen(file, "rb");
int keylen = strlen(value);
value[--keylen] = 0; // remove CR and fix keylen
if (fp) {
fseek(fp, 0, SEEK_END);
int len = ftell(fp);
fseek(fp, 0, SEEK_SET);
char *pbuf = malloc(len+1);
if (pbuf) {
fread(pbuf, len, 1, fp);
fclose(fp);
fp = NULL;
            char *p1 = pbuf, *p = pbuf;
while (p = strstr(p, value)) {
if (!fp){ fp = fopen(file, "wb");}
fwrite(p1, p - p1, 1, fp);
p += keylen;
p1 = p;
}
            if (p1) { // write rest of text
     fwrite(p1, (pbuf + len) - p1, 1, fp); // doesn't execute
//printf("file almost finished");
    }
}
fclose(fp);
    }
}


void killNL(char *str) {
 size_t p = strlen(str);
 if(str[p-1] == '\n') {
  str[p-1] = '\0';
 }
}

void addNewElement(void) {
 printf("Data to input :  ");
 if(fgets(carV, 256, stdin) == NULL) {
  fprintf(stderr, "Wrong Input\n");
  return;
 }
 killNL(carV);

 FILE *fp = fopen(file, "ab");

 if(fp == NULL) {
  printf("Error in open: %s\n", file);
  exit(EXIT_FAILURE);
 }
 if(fwrite(&carV, sizeof(carV), 1, fp) != 1) {
  fprintf(stderr, "Error in write, in %s\n", file);
  fclose(fp);
  return;
 }
 fclose(fp);
}

int main(void) {
addNewElement();
addNewElement();
    deleteElement();
return 0;
}

Thanks
3
Beginner questions / Re: How to delete some Content in a File ?
« Last post by Grincheux on October 16, 2019, 06:32:50 pm »
Some parts of the file could be locked.
4
Beginner questions / Re: Exec a child process
« Last post by Grincheux on October 16, 2019, 06:31:31 pm »
Here is what I did :

WM_CREATE :

   hGoogleEarth = FindWindow("Qt5QWindowIcon",NULL) ;
   SetParent(hGoogleEarth,hMainWindow) ;

into WM_DESTROY :

   SetParent(hGoogleEarth,hMainWindow) ;



The rest is into WM_SIZE

Thank you MS SPY.
Thank You Timo too.

My Blog for it (Sorry, in French)
5
Beginner questions / Re: Exec a child process
« Last post by TimoVJL on October 14, 2019, 09:15:49 pm »
Do you mean something like this?
Code: [Select]
void DoTest(HWND hWnd)
{
WinExec(TEXT("notepad.exe"), SW_HIDE);
Sleep(500);
HWND hWndChild = FindWindow(TEXT("Notepad"), NULL);
SetParent(hWndChild, hWnd);
RECT rect;
GetClientRect(hWnd, &rect);
MoveWindow(hWndChild, 0, 0, rect.right, rect.bottom, 0);
ShowWindow(hWndChild, SW_SHOW);
}
6
Beginner questions / Exec a child process
« Last post by Grincheux on October 14, 2019, 07:55:59 pm »
I have a window into which I would like to run Google Earth.
With CreateProcess Google Earth runs but outside my program.
How could I do?
I thought searching for the window hadle of Google Earth and setting it has a child window of my program.
Is it a solution?
7
Projects developed with Pelles C / Re: Bezier Curve Demo
« Last post by Rookie on October 14, 2019, 02:53:12 pm »
Now it works! Thanks for your help!
8
Projects developed with Pelles C / Re: Bezier Curve Demo
« Last post by Rookie on October 14, 2019, 11:37:21 am »
Enable Microsoft Extensions -Ze

Add-In for it:
https://forum.pellesc.de/index.php?topic=7399.msg28128#msg28128

Hi TimoVJL, Very Thanks for your replay! I try to apply this...
Thanks a lot
9
Projects developed with Pelles C / Re: Bezier Curve Demo
« Last post by TimoVJL on October 14, 2019, 11:21:07 am »
Enable Microsoft Extensions -Ze

Add-In for it:
https://forum.pellesc.de/index.php?topic=7399.msg28128#msg28128
10
Projects developed with Pelles C / Re: Bezier Curve Demo
« Last post by Rookie on October 14, 2019, 11:11:06 am »
Hi MichaelW,
I try to compile your code but...
i receive this error message:

Building bezier.obj.
C:\PellesC\Include\Win\winnt.h(105): fatal error #1014: #error: "No Target Architecture".
*** Error code: 1 ***
Done.


What is wrong?

Pages: [1] 2 3 ... 10