假设我有以下程序(hello.c):
#include <stdio.h>
#include <math.h>
#define NAME "ashoka"
int main(int argc, char *argv[])
{
printf("Hello, world! My name is %s\n", NAME);
}
Run Code Online (Sandbox Code Playgroud)
所以,据我所知,编译这个程序的过程是:
预处理:将复制粘贴stdio.h和math.h函数声明并替换NAME为"ashoka".
clang -E hello.c
Run Code Online (Sandbox Code Playgroud)编译:将c代码转换为汇编代码
clang -S hello.c
Run Code Online (Sandbox Code Playgroud)
生成的文件:hello.s
组装:将汇编代码转换为目标代码
clang -c hello.s
Run Code Online (Sandbox Code Playgroud)
生成的文件:hello.o
链接:将目标文件合并到一个我们将要执行的文件中.
clang hello.o -lm
Run Code Online (Sandbox Code Playgroud)
或者(假设我也想链接hello2.o)
clang hello.o hello2.o
Run Code Online (Sandbox Code Playgroud)所以,问题来了:
该过程描述的是正确的吗?
在链接阶段,我们将.o(对象代码)文件链接在一起.我知道它 …
我已经开始学习C(所以,你知道..指针).
我有这个代码:
#include <stdio.h>
#include <string.h>
int main (int argc, char* argv[])
{
char c = 'c';
char* cptr = &c;
printf("c = %c\n", c);
printf("*cptr = %c\n", *cptr);
printf("c address = %p\n", &c);
}
Run Code Online (Sandbox Code Playgroud)
我的输出是:
c = c
*cptr = c
c address = 0x7fff0217096f
Run Code Online (Sandbox Code Playgroud)
当我将上面的十六进制转换为十进制时,我得到:140720994002157
我的问题:
1)这个十进制值是否代表内存地址?不是太大了吗?
2)如何将指针的值(表示c变量的地址)打印为小数?
我部署了一个PHP应用程序,当我点击url时,我收到以下错误:
Forbidden
You don't have permission to access / on this server.
Run Code Online (Sandbox Code Playgroud)
我想它试图进入app /目录,但它不能.
我的项目结构:
my-project
|
|-> app/
|-> public/ (index.php inside here that takes care of routing)
Procfile
composer.json
etc.
Run Code Online (Sandbox Code Playgroud)
日志显示的内容:
Jul 24 12:44:08 cryptic-beyond-39147 app/web.1: [Sun Jul 24 19:44:07.846582 2016] [autoindex:error] [pid 99:tid 139960748263168] [client 10.179.164.130:28253] AH01276: Cannot serve directory /app/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive
Jul 24 12:44:08 cryptic-beyond-39147 app/web.1: 10.179.164.130 - - [24/Jul/2016:19:44:07 +0000] "GET / HTTP/1.1" …Run Code Online (Sandbox Code Playgroud) 我正在创建一个Web应用程序,我需要拨打这样的电话:
https://graph.facebook.com/639339682906611?access_token={my_access_token_here}
当我通过Graph API Explorer获取access_token时,它可以正常工作。但是过了一段时间(我认为是几天)之后,令牌过期了,我不得不再次手动进入Graph API Explorer来对其进行更新。
该网络应用无需用户登录。
有没有一种方法可以自动更新我的access_token?如果没有,是否有办法使我的access_token持续更长的时间?
facebook facebook-graph-api facebook-php-sdk facebook-access-token