السلام عليكم ورحمة الله وبركاته
فى هذا الموضوع حبيت أقدم يد العون للمبتدأين فى تعلم لغة السى والذى كثرة أسئلتهم عن المراجع المهمة والمناسبة للغة السى وكذلك دوال لغة الىس ملحوظة هامة(هذا الموضوع ليس لمن يعانى ألم فى المعدة مع المراجع الأجنبية :D ولكنى سوف أفرد بأذن الله لهم موضوع خاص لأهم المراجع العربية)
ونبدأ بأسم الله وعونه:
كتب للمبتدأين:
1-Object-Orientated Programming with ANSI-C
http://www.9q9q.org/index.php?image=dsyuutAb6QMLTP
2-C - Committee Draft of ISO9899:TC2
http://www.9q9q.org/index.php?image=O6eRRQ893hEcFb
3-C - The ISO Standard - Rationale
http://www.9q9q.org/index.php?image=tCIffe56083Zrm
4-C - Elements of Style
http://www.9q9q.org/index.php?image=4msggfFgda90Uu
5-Numerical Recipes in C - The Art of Scientific Computing
http://www.9q9q.org/index.php?image=2lr220WxuEe9ON
6-The C Book
http://www.9q9q.org/index.php?image=N4dJJIvwSIjirN
7-Writing Bug-Free C Code
http://www.9q9q.org/index.php?image=YioGGFGHeCdcgc
8-The New C Standard - A Cultural and Economic Commentary
http://www.9q9q.org/index.php?image=CRX553rsORUron
وفى النهاية أقدم لكم موقع للإجابة على تساؤلتكم التى ملئت المنتدى تفضلوا:
خلاص كدخ خلصنا من المبتدأين ندخل بقى فى المتوسطين :wacko:
المتوسطين:
وهنا يبدأ التسؤالات حول الفروق بين لغة السى ولغة السى ++ وحبيت أضيف بعد الأقتباسات اللطيفة من بعد المواقع الأجنبية
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg.
وفى الأعلى يوضح مدى سهولة تعامل السى مع النظام والهاردوير والذاكرة والتى تعتبر خطيرة حيث أنك أذا لم تحسن أستخدامها أصبحت ضرر عليك وسببت الكثير من المشاكل ولنفرض الضرر الذى تحدثه فرمتت الجهاز لنوضح الفرق بين الضررين وقوة كل منهما وأهميتها أم لغة السى ++ فهى تجعلها صعبة عليك ولكن يمكنك فعلها وأذا فعلتها وبأسلوب خاطأ لن يكفى فرمتت الجهاز وأنما أذهب وأشترى جهاز جديد :D
"If C gives you enough rope to hang yourself, then C++ gives you enough rope to bind and gag your neighborhood, rig the sails on a small ship, and still have enough rope to hang yourself from the yardarm"
وهى نفس المعنى فى الأعلى ولكن بأسلوب أخر حث فى السى سيصيب الضرر أنت واحدك ولكن فى السى++ سيصبك أنت والمنطقة كلها
وهذا حل لثغرة Buffer overflow بكود لغة السى
It is not wise to use the ANSI standard strcpy function because of the possibility of unchecked buffer overflows. The better strncpy function has the problem that it does not properly terminate the string. The following strlcpy and strlcat functions are simple implementations that manage the problems of their original ANSI ancestors.
#include <string.h>
size_t strlcpy(char *d, const char *s, size_t bufsize)
{
size_t len;
size_t ret;
if (!d || !s) return 0;
len = strlen(s);
ret = len;
if (bufsize <= 0) return 0;
if (len >= bufsize) len = bufsize-1;
memcpy(d, s, len);
d[len] = 0;
return ret;
}
size_t strlcat(char *d, const char *s, size_t bufsize)
{
size_t len1;
size_t len2;
size_t ret;
if (!d || !s || bufsize <= 0) return 0;
len1 = strlen(d);
len2 = strlen(s);
ret = len1 + len2;
if (len1+len2 >= bufsize)
{
len2 = bufsize - (len1+1);
}
if (len2 > 0)
{
memcpy(d+len1, s, len2);
d[len1+len2] = 0;
}
return ret;
}
Updated: 27 December 2003 by adding checks for null strings.
Interestingly, we found a much more complicated version of these functions somewhere on the net. The fact that it had typos in it and wouldn't compile straightaway didn't fill us with confidence. This version is cleaner.
For more on the principles behind their design and advice on their usage see strlcpy and strlcat - consistent, safe, string copy and concatenation by Todd C. Miller and Theo de Raadt.
Windows programmers should refer to Microsoft's Using the Strsafe.h Functions. As with all Microsoft's pages, it may have moved again.
We also like to use this modified version of strlen when users might send us a null string
size_t strllen(const char *string)
{
if (!string) return 0;
return strlen(string);
}
More on buffer overflows - MSVC's _snprintf function
The functions sprintf and Win32 wsprintf have similar problems with buffer overflow. The snprintf function provided in (recent) Unix implementations like GCC solve the problem admirably. In MSVC there is a similarly named _snprintf function that you'd expect to do the same thing, wouldn't you? Wrong! Spot the difference:
Unix: The snprintf() function will write at most size-1 of the characters printed into the output string (the size'th character then gets the terminating `\0'); if the return value is greater than or equal to the size argument, the string was too short and some of the printed characters were discarded. The output is always null-terminated.
MSVC: _snprintf returns the number of bytes stored in buffer, not counting the terminating null character. If the number of bytes required to store the data exceeds count, then count bytes of data are stored in buffer and a negative value is returned.
Can you see the problem? In the Unix version, the output is always null-terminated. In MSVC, it's not.
Here's a compromise solution we use in MSVC environments. It returns a negative value on overflow instead of the required number but the output is always null-terminated.
#include <stdio.h>
#include <stdarg.h>
int slprintf(char *buffer, size_t count, const char *fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
ret = _vsnprintf(buffer, count-1, fmt, ap);
if (ret < 0)
buffer[count-1] = '\0';
va_end(ap);
return ret;وهذه أيضا بعد المواقع المهمة لدوال اللغة للمتوسطين:
هذا الموقع فه كل ما تبحث عنه من البداية حتى الأحتراف:
وهذا الموقع يوجد فيه إرشادات حول المتغيرات والملفات الرأسية وأشياء أخرى كثير مع أنها بسيطة ولكنها سر تميز مبرمج عن مبرمج:
وهذا الموقع مخصوصا للأخ sniper لكى تتضح إجابات أسئلة أكثر أمام عينيه :
بصراحة مواضيع المتوسطين مبتخلص ولكن للأسف لابد أن أنهى الموضوع والا لن أنهى فى قرون :blink:
المتقدمين:
هذه مواقع منقية مخصوص لأعين المتقدمين أتفضلوا ;) :
هذا موقع مهم جدا عن التعامل مع الملفات والتعامل مع الذاكرة وال heap وكذلك فى أخر الصفحة برامج مهمة ويا ريت تفهمها مش قص ولصق وخلاص :D
وده موقع بيضم من أهم النصائح لمبرمج لغة السى تفضلوا:
وهذا موقع للبرمجة بلغة السى تحت نطاق ويندوز بأستخدام sdk-c
ولا أنسى عشاق الخورازميات وأقدم لهم تحليل الخورازميات فى لغة السى :
ولا ننسى التعامل مع الريجسترى من خلال لغة السى
ولكن لا أنصحك بالتعامل المباشر مع الريجسترى وأنما أنصحك بأستخدام أوامر النظام فى كتابة ملف Reg ومن ثم التعديل فى قيم الريجستيرى
وهذا موقع متخصص ولكن لا يشمل لغة السى وأنما أحزاء بسيطة
وفى النهاية أتأسف على هذا التقسيم ولكن حبيت أقسم ما توصلت إليه ولكن لا أقصد أن هذه الكتب للمحترفين وأنما هى للمحترفين بالنسبة لى حيث أنها أخر ما توصلت إليه وتعاملت معه من أسرار اللغة لإهذه مكتبتى البسيطة وأنا مجرد مبتدأ وعافونى أذا قصرت فى حقكم أو أهملت شىء مهم وأنا متأكد أنى أهملت الكثير ولكن هذا أخر خبراتى
وأرجو أن أكون أفدت ولو شخص واحد
سلام

