Getting the first 10 characters of a string?

I have not been able to find any information with a web-search. Where should I be looking?

Answers


char myString[256];
char dest[256]

strncpy(dest, myString,10);
dest[10] = 0; //null terminate destination

Need Your Help

Placeholder text runs out of the textarea in Safari?

css forms html5 safari placeholder

You can see the problem if you open these links in safari (version 5+)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.