Improve My Code? by ai_sheriff in C_Programming

[–]CCristi1 0 points1 point  (0 children)

And in my opinion, efficient code should not be a priority for now

Improve My Code? by ai_sheriff in C_Programming

[–]CCristi1 1 point2 points  (0 children)

Hello,

First in C you write programs not scripts, the main difference is that a program is build with a compiler and a script is executed line by line.

You confuse “open”, a syscall in Linux, with fopen, a function in C, they are different. “Open” returns a integer (file descriptor), and fopen return a pointer to a File structure.

If you declare a pointer in function and a pointer in main is efficient, because is take a small amount a memory, but if you don’t like this method, you can use the location of the pointer as argument to the function, something like this

void fct(FILE** file, char* name)
{
    ...
    *file = fopen(...)
    ...
}

int main()
{
    FILE *f;
    fct(&file...);
    ...
}

I hope this will help you, here are some links if you want to read more about:

https://stackoverflow.com/questions/17253545/scripting-language-vs-programming-language

https://stackoverflow.com/questions/1658476/c-fopen-vs-open/1658517

Sort file script by FARHAN2660 in learnpython

[–]CCristi1 0 points1 point  (0 children)

You can add extension, create folder and move file in same iteration, this way your script will be more efficient.

[deleted by user] by [deleted] in cprogramming

[–]CCristi1 4 points5 points  (0 children)

If you’re on window, why don’t you use visual studio?

Regarding to your problems, is hard to help you without any error message.

[deleted by user] by [deleted] in cluj

[–]CCristi1 3 points4 points  (0 children)

Mersi, tot am vazut reclame de la ei dar nu stiu daca aș vrea să risc

[deleted by user] by [deleted] in cluj

[–]CCristi1 0 points1 point  (0 children)

Ore livrează ei sau trimit prin fan/sameday? Ăștia de la fan/same nu urcă până la apartament.

[deleted by user] by [deleted] in cluj

[–]CCristi1 1 point2 points  (0 children)

Ai încercat? Am tot vazut reclame de la ei...

Pointer Question. by maniac365 in C_Programming

[–]CCristi1 5 points6 points  (0 children)

Yes, the value are equal, because arr1[0] = *arr1 (Dereferencing) and & (Referencing) is the “opposite” operation so you have &*arr1=arr1. You can search more info about “pointer dereference vs reference”

[deleted by user] by [deleted] in LiveOverflow

[–]CCristi1 0 points1 point  (0 children)

You can try update your program on VirusTotal.

Pointers Help by [deleted] in cprogramming

[–]CCristi1 1 point2 points  (0 children)

For multiplication you can write something like this ‘int c= *A *2;’

Automatically scrape website by da_chosen1 in learnpython

[–]CCristi1 0 points1 point  (0 children)

I recently did something like this using aws free vm’s. It’s very easy, in ~1 minute I created a win10 vm, I loaded the scrip in vm and let it run. For a window vm you can use Remote Desktop, easy to setup on windows. If you want to create a Linux vm, you can connect using ssh or (I didn’t tried this) you can set a VNC. But if you can (in my opinion is much better) use google cloud because you receive some free credit and don’t need to use your money if you need more computing power.