19,596
edits
Paradox-01 (talk | contribs) mNo edit summary |
m (+cat) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
* Visual Studio | * Visual Studio | ||
** Choose C++ template (empty project). Add new file but rename extension from cpp to c. | ** Choose C++ template (empty project). Add new file but rename extension from cpp to c. | ||
==Language== | |||
C exists in different versions, the so called [[wp:ANSI_C#History_and_outlook|standards]]: ANSI/C90, [https://www.open-std.org/JTC1/sc22/wg14/www/docs/n1256.pdf C99], C11, ... | |||
==.h== | ==.h== | ||
Line 77: | Line 80: | ||
//#include <stdbool.h> | //#include <stdbool.h> | ||
//bool a = true; | //bool a = true; | ||
// C99 standard | |||
[https://stackoverflow.com/questions/8724349/difference-between-bool-and-bool-types-in-c _Bool b = 1;] | [https://stackoverflow.com/questions/8724349/difference-between-bool-and-bool-types-in-c _Bool b = 1;] | ||
Line 84: | Line 89: | ||
---- | ---- | ||
Arrays, pointers, conversions, globals, ... | |||
Arrays, pointers, conversions, globals, [https://stackoverflow.com/questions/10586003/try-catch-statements-in-c try catch simulation], [https://stackoverflow.com/questions/154136/why-use-apparently-meaningless-do-while-and-if-else-statements-in-macros?rq=1 macros] ... | |||
---- | |||
==Files== | |||
==Directories== | |||
_getcwd can be used to get program path when main function arg is not an option. | |||
#include <direct.h> // _getcwd | |||
#include <stdlib.h> // free, perror | |||
#include <stdio.h> // printf | |||
#include <string.h> // strlen | |||
int main( void ) | |||
{ | |||
char* buffer; | |||
// Get the current working directory: | |||
if ( (buffer = _getcwd( NULL, 0 )) == NULL ) | |||
perror( "_getcwd error" ); | |||
else | |||
{ | |||
printf( "%s \nLength: %zu\n", buffer, strlen(buffer) ); | |||
free(buffer); | |||
} | |||
} | |||
[[Category:Userspace]] |